You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [39]: d1 = Index(pd.date_range('1/1/2012', '3/1/2012', freq='MS'), name='date')
...: df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]}, index=d1)
...: df.columns.names=['id']
...: s = df.unstack()
...: s.name = 'value'
...:
In [40]: s
Out[40]:
id date
A 2012-01-01 1
2012-02-01 2
2012-03-01 3
B 2012-01-01 4
2012-02-01 5
2012-03-01 6
Name: value, dtype: int64
In [41]: s.resample('D', level='date').asfreq()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-41-810faaa64080> in <module>()
----> 1 s.resample('D', level='date').asfreq()
/Users/jreback/pandas/pandas/core/resample.py in asfreq(self, fill_value)
518 DataFrame.asfreq
519 """
--> 520 return self._upsample('asfreq', fill_value=fill_value)
521
522 def std(self, ddof=1, *args, **kwargs):
/Users/jreback/pandas/pandas/core/resample.py in _upsample(self, method, limit, fill_value)
737 raise AssertionError('axis must be 0')
738 if self._from_selection:
--> 739 raise ValueError("Upsampling from level= or on= selection"
740 " is not supported, use .set_index(...)"
741 " to explicitly set index to"
ValueError: Upsampling from level= or on= selection is not supported, use .set_index(...) to explicitly set index to datetime-like
This is like #7895 in that we are reindexing on a level (generated via resample). So it equivalent in this case.
This should work.
The text was updated successfully, but these errors were encountered:
example from #7895
This is like #7895 in that we are reindexing on a level (generated via resample). So it equivalent in this case.
This should work.
The text was updated successfully, but these errors were encountered: