python - Plotting Pandas Time Data -
my data pandas dataframe called 't':
b c date 2001-11-13 30.1 2 3 2007-02-23 12.0 1 7
the result of t.index
<class 'pandas.tseries.index.datetimeindex'> [2001-11-13, 2007-02-23] length: 2, freq: none, timezone: none
so know index time series. when plot using ax.plot(t)
don't times series on x axis!
i ever have 2 data points how dates in graph (i.e. 2 dates @ either end of x axis)?
use implemented pandas command:
in[211]: df2 out[211]: b c 1970-01-01 30.1 2 3 1980-01-01 12.0 1 7 in[212]: df2.plot() out[212]: <matplotlib.axes.axessubplot @ 0x105224e0> in[213]: plt.show()
you can access axis using
ax = df2.plot()
Comments
Post a Comment