In [17]: series=pd.Series(range(10), pd.period_range(start='2000', periods=10, name='date', freq='M')) In [18]: series Out[18]: date 2000-01 0 2000-02 1 2000-03 2 2000-04 3 2000-05 4 2000-06 5 2000-07 6 2000-08 7 2000-09 8 2000-10 9 Freq: M, dtype: int64 In [19]: series.index Out[19]: PeriodIndex(['2000-01', '2000-02', '2000-03', '2000-04', '2000-05', '2000-06', '2000-07', '2000-08', '2000-09', '2000-10'], dtype='int64', name='date', freq='M') # Note name='date' In [20]: series.resample('D').pad().index Out[20]: PeriodIndex(['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04', '2000-01-05', '2000-01-06', '2000-01-07', '2000-01-08', '2000-01-09', '2000-01-10', ... '2000-10-22', '2000-10-23', '2000-10-24', '2000-10-25', '2000-10-26', '2000-10-27', '2000-10-28', '2000-10-29', '2000-10-30', '2000-10-31'], dtype='int64', length=305, freq='D') # now no nameExpected Output
Out[20]: PeriodIndex(['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04', '2000-01-05', '2000-01-06', '2000-01-07', '2000-01-08', '2000-01-09', '2000-01-10', ... '2000-10-22', '2000-10-23', '2000-10-24', '2000-10-25', '2000-10-26', '2000-10-27', '2000-10-28', '2000-10-29', '2000-10-30', '2000-10-31'], dtype='int64', length=305, freq='D', name='date')output of
pd.show_versions()
Out[21]: '0.18.0'
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