Hi,

I have a csv file where head -5 looks like this:

A  B   C
100  0.45  0.3
67  0.25  0.4
50.6  0.2  0.6
56.4  0.4  0.3

The columns are tab separated. I want to load this CSV file and plot the
histogram of the third or second column. I was able to load the csv file
using this:
data=csv2rec('Downloads/Sample.txt',delimiter='\t',skiprows=0)
The file has 2792 rows including the top header row.

When I do
>> data['A'] I get this error:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-19-856828b8eaa3> in <module>()
----> 1 data['A']

/Library/Python/2.7/site-packages/numpy-1.9.0.dev_297f54b-py2.7-macosx-10.9-intel.egg/numpy/core/records.pyc
in __getitem__(self, indx)
    457 
    458     def __getitem__(self, indx):
--> 459         obj = ndarray.__getitem__(self, indx)
    460         if (isinstance(obj, ndarray) and obj.dtype.isbuiltin):
    461             return obj.view(ndarray)

ValueError: field named A not found

First is data['A'] supposed to read the whole A column? Once I read the
column I want to be able to plot it. Can I simply do 
>> hist(data['A'],bins=30) or something like that.

Many thanks,
AR




--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Loding-CSV-file-and-plotting-histogram-of-a-particular-column-tp42938.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to