AR12 wrote:

 > 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']

numpy.csv2rec lowercases the column names.
"If *names* is *None*, a header row is required to automatically
assign the recarray names.  The headers will be lower cased,
spaces will be converted to underscores, and illegal attribute
name characters removed.  If *names* is not *None*, it is a
sequence of names to use for the column names.  In this case, it
is assumed there is no header row."

So data['a'] should do it.
-- 
Piet van Oostrum <p...@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]

------------------------------------------------------------------------------
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