Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102376
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: ts.plot() pandas: No plot! |
| Date | 2016-02-01 12:15 +1100 |
| Message-ID | <mailman.178.1454289336.2338.python-list@python.org> (permalink) |
| References | <n8m9sb$6ss$1@gioia.aioe.org> |
On Mon, Feb 1, 2016 at 11:46 AM, Paulo da Silva
<p_s_d_a_s_i_l_v_a_ns@netcabo.pt> wrote:
> I am learning pandas and following the tutorial I tried the following:
> ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000',
> periods=1000))
> ts = ts.cumsum()
> ts.plot()
>
> No plot is produced!
> Only the following output:
> <matplotlib.axes.AxesSubplot object at 0x7f33019b6630>
>
> Any clue on what is happening?
>
> I'm using kubuntu and python3.
>
Hmm. Normally I would expect matplotlib to pop up a graph there. Are
you running this from a terminal, or from some sort of GUI? It might
make a difference to how it brings up the graph. Interestingly, I'm
not able to run your example on my system:
>>> pd.__version__
'0.17.1'
>>> pd.date_range('1/1/2000', periods=1000)
ValueError: Error parsing datetime string "1/1/2000" at position 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/pandas/tseries/index.py",
line 1923, in date_range
closed=closed, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pandas/util/decorators.py",
line 89, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pandas/tseries/index.py",
line 237, in __new__
ambiguous=ambiguous)
File "/usr/local/lib/python3.6/site-packages/pandas/tseries/index.py",
line 379, in _generate
start = Timestamp(start)
File "pandas/tslib.pyx", line 299, in pandas.tslib.Timestamp.__new__
(pandas/tslib.c:8973)
File "pandas/tslib.pyx", line 1163, in
pandas.tslib.convert_to_tsobject (pandas/tslib.c:22522)
File "pandas/tslib.pyx", line 1271, in
pandas.tslib.convert_str_to_tsobject (pandas/tslib.c:24121)
File "pandas/src/datetime.pxd", line 141, in datetime._string_to_dts
(pandas/tslib.c:80505)
SystemError: <class 'str'> returned a result with an error set
So it's possible you've run into something that's changed between
versions. Your original example works on my 2.7, although it doesn't
pop up a graph. So now I'm a bit lost. :)
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
ts.plot() pandas: No plot! Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2016-02-01 00:46 +0000
Re: ts.plot() pandas: No plot! Chris Angelico <rosuav@gmail.com> - 2016-02-01 12:15 +1100
Re: ts.plot() pandas: No plot! Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2016-02-01 01:30 +0000
Re: ts.plot() pandas: No plot! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-02-01 01:43 +0000
Re: ts.plot() pandas: No plot! Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2016-02-01 02:08 +0000
Re: ts.plot() pandas: No plot! Jason Swails <jason.swails@gmail.com> - 2016-02-01 09:18 -0500
Re: ts.plot() pandas: No plot! Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2016-02-01 19:22 +0000
csiph-web