df = pd.DataFrame({'RandomValues': np.random.randint(1, 50, 60)},
index=pd.date_range("2012-01-01", periods=60))
Plotting of course works:
In [79]: df.plot()
Out[79]: <matplotlib.axes._subplots.AxesSubplot at 0xf571550>
But plotting with matplotlib's plot
functions gives no longer a datetime formatted x-axis, but just ints:
In [80]: plt.plot(df.index, df.RandomValues)
Out[80]: [<matplotlib.lines.Line2D at 0xfb5f748>]
Reason: matplotlibs plot
calls np.atleast_1d
on the input (https://github.com/matplotlib/matplotlib/blob/v1.4.0/lib/matplotlib/axes/_base.py#L220). Previously this returned an Index, now it returns a array of datetime64
values, which matplotlib can't handle.
Issues:
Index
also.It seems there was some discussion about this in the Index-no-subclass PR: #7891 (comment) and #7891 (comment) (I commented there about exactly this issue, but I don't know why we didn't look further in it then)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4