SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S






1
(1)
2
(1)
3
(9)
4
(2)
5
6
(6)
7
(3)
8
(1)
9
(6)
10
(1)
11
12
13
(2)
14
(8)
15
(2)
16
17
(11)
18
(5)
19
(2)
20
(2)
21
(4)
22
(2)
23
(5)
24
(6)
25
26
27
(2)
28
(9)

Showing 9 results of 9

From: Sterling S. <sm...@fu...> - 2014年02月28日 21:57:21
Aarthi,
For me to help further, you will need to provide a sample input file, and the script you are trying to use to read that input file. Then I can go from there.
-Sterling
On Feb 28, 2014, at 1:38PM, Aarthi Reddy wrote:
> It is not an uppercase problem. The other two titles had combination of upper and lower case. All columns have the exact same number of lines and there are no empty entries.
> 
> On Feb 28, 2014, at 3:31 PM, Sterling Smith <sm...@fu...> wrote:
> 
>> You have an uppercase 'Confidence'. Are you using pandas or numpy? For numpy, from Piet's email, you need a lowercase key. What does 
>> `print df['Confidence'].shape`
>> yield? Because the error looks like you have an array with no size (zero dimensions), so perhaps you are still not reading in your file correctly.
>> 
>> -Sterling
>> 
>> On Feb 28, 2014, at 1:02PM, AR12 wrote:
>> 
>>> Thanks, this worked for two of the columns. For the third column, I get this error: Sorry to bug you about this. Do you know where I can find the solution to this problem?
>>> 
>>> ---------------------------------------------------------------------------
>>> TypeError Traceback (most recent call last)
>>> <ipython-input-10-ae5186552dfe> in <module>()
>>> ----> 1 plt.hist(df['Confidence'],bins=10)
>>> 
>>> /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/pyplot.pyc in hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, hold, **kwargs)
>>> 2875 histtype=histtype, align=align, orientation=orientation,
>>> 2876 rwidth=rwidth, log=log, color=color, label=label,
>>> -> 2877 stacked=stacked, **kwargs)
>>> 2878 draw_if_interactive()
>>> 2879 finally:
>>> 
>>> /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/axes/_axes.pyc in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
>>> 5477 xmax = -np.inf
>>> 5478 for xi in x:
>>> -> 5479 if len(xi) > 0:
>>> 5480 xmin = min(xmin, xi.min())
>>> 5481 xmax = max(xmax, xi.max())
>>> 
>>> TypeError: len() of unsized object
>>> 
>>> 
>>> On Fri, Feb 28, 2014 at 2:42 PM, Paul Hobson-2 [via matplotlib] <[hidden email]> wrote:
>>> Sounds like you want to use pandas, not numpy.
>>> 
>>> import pandas
>>> import matplotlib.pyplot as plt
>>> df = pandas.read_csv('myfile.txt', sep='\t')
>>> plt.hist(data['A'], bins=30)
>>> 
>>> ...should do it for you. 
>>> 
>>> 
>>> On Fri, Feb 28, 2014 at 11:06 AM, AR12 <[hidden email]> 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']
>>> 
>>> /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
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>> 
>>> 
>>> ------------------------------------------------------------------------------ 
>>> 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 
>>> [hidden email] 
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>> 
>>> 
>>> If you reply to this email, your message will be added to the discussion below:
>>> http://matplotlib.1069221.n5.nabble.com/Loding-CSV-file-and-plotting-histogram-of-a-particular-column-tp42938p42942.html
>>> To unsubscribe from Loding CSV file and plotting histogram of a particular column, click here.
>>> NAML
>>> 
>>> 
>>> 
>>> -- 
>>> Aarthi Reddy
>>> 408-603-1385
>>> 
>>> View this message in context: Re: Loding CSV file and plotting histogram of a particular column
>>> 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
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Sterling S. <sm...@fu...> - 2014年02月28日 21:31:14
You have an uppercase 'Confidence'. Are you using pandas or numpy? For numpy, from Piet's email, you need a lowercase key. What does 
`print df['Confidence'].shape`
yield? Because the error looks like you have an array with no size (zero dimensions), so perhaps you are still not reading in your file correctly.
-Sterling
On Feb 28, 2014, at 1:02PM, AR12 wrote:
> Thanks, this worked for two of the columns. For the third column, I get this error: Sorry to bug you about this. Do you know where I can find the solution to this problem?
> 
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call last)
> <ipython-input-10-ae5186552dfe> in <module>()
> ----> 1 plt.hist(df['Confidence'],bins=10)
> 
> /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/pyplot.pyc in hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, hold, **kwargs)
> 2875 histtype=histtype, align=align, orientation=orientation,
> 2876 rwidth=rwidth, log=log, color=color, label=label,
> -> 2877 stacked=stacked, **kwargs)
> 2878 draw_if_interactive()
> 2879 finally:
> 
> /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/axes/_axes.pyc in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
> 5477 xmax = -np.inf
> 5478 for xi in x:
> -> 5479 if len(xi) > 0:
> 5480 xmin = min(xmin, xi.min())
> 5481 xmax = max(xmax, xi.max())
> 
> TypeError: len() of unsized object
> 
> 
> On Fri, Feb 28, 2014 at 2:42 PM, Paul Hobson-2 [via matplotlib] <[hidden email]> wrote:
> Sounds like you want to use pandas, not numpy.
> 
> import pandas
> import matplotlib.pyplot as plt
> df = pandas.read_csv('myfile.txt', sep='\t')
> plt.hist(data['A'], bins=30)
> 
> ...should do it for you. 
> 
> 
> On Fri, Feb 28, 2014 at 11:06 AM, AR12 <[hidden email]> 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']
> 
> /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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> ------------------------------------------------------------------------------ 
> 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 
> [hidden email] 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://matplotlib.1069221.n5.nabble.com/Loding-CSV-file-and-plotting-histogram-of-a-particular-column-tp42938p42942.html
> To unsubscribe from Loding CSV file and plotting histogram of a particular column, click here.
> NAML
> 
> 
> 
> -- 
> Aarthi Reddy
> 408-603-1385
> 
> View this message in context: Re: Loding CSV file and plotting histogram of a particular column
> 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: AR12 <aar...@gm...> - 2014年02月28日 21:02:34
Thanks, this worked for two of the columns. For the third column, I get
this error: Sorry to bug you about this. Do you know where I can find the
solution to this problem?
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-ae5186552dfe> in <module>()
----> 1 plt.hist(df['Confidence'],bins=10)
/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/pyplot.pycin
hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align,
orientation, rwidth, log, color, label, stacked, hold, **kwargs)
 2875 histtype=histtype, align=align, orientation=
orientation,
 2876 rwidth=rwidth, log=log, color=color, label=
label,
-> 2877 stacked=stacked, **kwargs)
 2878 draw_if_interactive()
 2879 finally:
/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/axes/_axes.pycin
hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype,
align, orientation, rwidth, log, color, label, stacked, **kwargs)
 5477 xmax = -np.inf
 5478 for xi in x:
-> 5479 if len(xi) > 0:
 5480 xmin = min(xmin, xi.min())
 5481 xmax = max(xmax, xi.max())
TypeError: len() of unsized object
On Fri, Feb 28, 2014 at 2:42 PM, Paul Hobson-2 [via matplotlib] <
ml-...@n5...> wrote:
> Sounds like you want to use pandas, not numpy.
>
> import pandas
> import matplotlib.pyplot as plt
> df = pandas.read_csv('myfile.txt', sep='\t')
> plt.hist(data['A'], bins=30)
>
> ...should do it for you.
>
>
> On Fri, Feb 28, 2014 at 11:06 AM, AR12 <[hidden email]<http://user/SendEmail.jtp?type=node&node=42942&i=0>
> > 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']
>>
>>
>> /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
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=42942&i=1>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> ------------------------------------------------------------------------------
>
> 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
> [hidden email] <http://user/SendEmail.jtp?type=node&node=42942&i=2>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/Loding-CSV-file-and-plotting-histogram-of-a-particular-column-tp42938p42942.html
> To unsubscribe from Loding CSV file and plotting histogram of a
> particular column, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=42938&code=YWFydGhpLnJlZGR5QGdtYWlsLmNvbXw0MjkzOHwtMTMwMjY3NTYwMA==>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
Aarthi Reddy
408-603-1385
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Loding-CSV-file-and-plotting-histogram-of-a-particular-column-tp42938p42944.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Piet v. O. <pi...@va...> - 2014年02月28日 20:52:18
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 <pi...@va...>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
From: Paul H. <pmh...@gm...> - 2014年02月28日 20:42:11
Sounds like you want to use pandas, not numpy.
import pandas
import matplotlib.pyplot as plt
df = pandas.read_csv('myfile.txt', sep='\t')
plt.hist(data['A'], bins=30)
...should do it for you.
On Fri, Feb 28, 2014 at 11:06 AM, AR12 <aar...@gm...> 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']
>
>
> /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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Michael D. <md...@st...> - 2014年02月28日 20:26:44
On 02/27/2014 06:58 PM, Jon Roadley-Battin wrote:
> Good evening,
>
> I am at present migrating an application of mine from py27+pygtk (with 
> mpl) to py33+pygobject (gtk3)
>
> Unfortunately I am unable to use
>
> from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
> from matplotlib.backends.backend_gtk3 import NavigationToolbar2GTK3 as NavigationToolbar
>
> Which is is on the examples ( 
> http://matplotlib.org/examples/user_interfaces/embedding_in_gtk3_panzoom.html 
> ) but is also the logical translation from what I presently have.
> This falls fowl of the cairo issue
>
> What I am having to use is backend_gtk3cairo. However this is being 
> triggered
>
> raise ValueError("The Cairo backend can not draw paths longer than 
> 18980 points.")
>
> I am generally plotting 7 x-y plots with upto 30,000 points.
> Now for now I have commented this out from my local install, is there 
> a better/preferred/recommended alternative?
This was put in there because cairo had (at least at the time) a hard 
coded limit on path size, and getting a Python exception was IMHO 
preferable to segfaulting and having the process go away. Are you 
saying that when you comment it out, it's currently working? It may be 
that cairo has fixed this limit in the intervening years. Can you 
provide a simple, standalone example that reproduces the error?
> I have read about cairocffi but this doesn't 
> seem conveniently possible at this moment in time (especially for 
> windows)
I'm not sure if the Python wrappers will matter, since this issue is 
actually in the underlying Cairo library.
>
> Equally I have seen mpl-devel mailing list entries from 4years ago 
> stating that this check was to be removed (a cairo 1.4.10 issue)
Are you referring to this thread?
http://matplotlib.1069221.n5.nabble.com/Path-length-in-the-cairo-backend-td36582.html
The conclusion there (if you scroll down) was that the check is still 
needed as of Cairo 1.8.
Mike
>
> JonRB
>
>
> ------------------------------------------------------------------------------
> 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
 _
|\/|o _|_ _. _ | | \.__ __|__|_|_ _ _ ._ _
| ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | |
http://www.droettboom.com
From: Adam H. <hug...@gm...> - 2014年02月28日 20:21:00
Sorry, it seems that I didn't have dvipng installed correctly!
On Fri, Feb 28, 2014 at 2:53 PM, Adam Hughes <hug...@gm...> wrote:
> Hi,
>
> In an IPython notebook, I've changed several setting in both the
> notebook's style and the plotting style. I noticed that when I change the
> usetex option in the rcparams:
>
> *rcParams['text.usetex'] = True *
>
> Then I add an integral sign as text to a plot (either title or axis label)
>
> *plt.title($\int_0^\infty$)*
>
> The integral symbol is not rendered. Changing usetex to false results in
> properly rendering.
>
> Can anyone reproduce this?
>
>
From: Adam H. <hug...@gm...> - 2014年02月28日 19:53:46
Hi,
In an IPython notebook, I've changed several setting in both the notebook's
style and the plotting style. I noticed that when I change the usetex
option in the rcparams:
*rcParams['text.usetex'] = True *
Then I add an integral sign as text to a plot (either title or axis label)
*plt.title($\int_0^\infty$)*
The integral symbol is not rendered. Changing usetex to false results in
properly rendering.
Can anyone reproduce this?
From: AR12 <aar...@gm...> - 2014年02月28日 19:06:23
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.

Showing 9 results of 9

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /