Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type(df.index)
- type(df.index)
- class 'pandas.tseries.period.PeriodIndex'
- VAR(mdata)
- Given a pandas object and the index does not contain dates
- df.index = pandas.DatetimeIndex(df.index)
- cannot convert Int64Index->DatetimeIndex
- In [25]: pidx = pd.period_range('2012-01-01', periods=10)
- In [26]: pidx
- Out[26]:
- <class 'pandas.tseries.period.PeriodIndex'>
- [2012-01-01, ..., 2012-01-10]
- Length: 10, Freq: D
- In [27]: pidx.to_timestamp()
- Out[27]:
- <class 'pandas.tseries.index.DatetimeIndex'>
- [2012-01-01, ..., 2012-01-10]
- Length: 10, Freq: D, Timezone: None
- idx.astype('datetime64[ns]')
- idx.to_period(freq='D')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement