I am currently trying to plot (my first) very simple line chart from a Pandas dataframe.
My (partial) code is:
data = {'Date': dates,
'Daily Return': daily_return,
'Cumulative': cumulative}
df = pd.DataFrame(data, columns=['Date', 'Daily Return', 'Cumulative'])
ts = df[['Date', 'Cumulative']]
print ts.head()
print ""
print ts.dtypes
ts.plot()
And my output is:
Date Cumulative
0 2014-01-02 100.903375
1 2014-01-03 101.344302
2 2014-01-06 101.080674
3 2014-01-07 101.080674
4 2014-01-08 101.493248
Date datetime64[ns]
Cumulative float64
dtype: object
Axes(0.125,0.1;0.775x0.8)
showing that "ts" is a legitimate dataframe as I can print out its "head" call and its datatypes.
But no plot window appears - and I do not understand why.
The documentation (found here: http://pandas.pydata.org/pandas-docs/version/0.15.0/visualization.html) for plotting a Pandas dataframe suggests the following code:
In [2]: ts = Series(randn(1000), index=date_range('1/1/2000', periods=1000))
In [3]: ts = ts.cumsum()
In [4]: ts.plot()
Why will my ts.plot() call not work - why is no plot window appearing?
I have searched many information sources and all of them suggest that extremely simple "dataframe.plot()" syntax but I just can not get it to work.
I receive no error message at all.
UPDATE
I cam across this post: matplotlib plot window won't appear and so...
I have run the following commands:
import matplotlib
print matplotlib.rcParams['backend']
in my console window and get the following message:
Backend WXAgg is interactive backend. Turning interactive mode on.
WXAgg
Is this information at all relevant?