After using the asfreq
method to change the frequency of a time-series DataFrame from None
to something e.g. 15Min
the cursor position in matplotlib graphs of that DataFrame is no longer correct (usually shows a datetime just after the unix epoch). The following demonstrates this (NB dt in df1 is not a constant):
df1 = pandas.read_csv('tseries1.csv', names=['tstamp', 'Q'], parse_dates=True,
index_col='tstamp').clip_lower(0).fillna(0)
df1['T'] = pandas.read_csv('tseries2.csv', names=['tstamp', 'T'], parse_dates=True,
index_col='tstamp', squeeze=True).clip_lower(0).fillna(0)
df2 = df1.asfreq(freq='15Min', method='ffill')
# NB df1.index.freq is None
# NB df2.index.freq is <15 * Minutes>
df1.plot()
df2.plot()
plt.show()
I find the Matplotlib cursor position to be invaluable when looking for features in very long time-series.
Versions:
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