-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Closed
Labels
BugDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestGroupbyReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Description
Using the groupby().rolling() object seems to duplicate a level of the index.
In [9]: d.groupby(level='ticker').rolling(30).mean()
Out[9]:
ticker ticker date
BMO BMO 2006-01-02 NaN
2006-01-03 NaN
TD TD 2016-09-22 57.139340
2016-09-23 57.171864
In [10]: d.groupby(level='ticker').apply(pd.rolling_mean, 30)
Out[10]:
ticker date
BMO 2006-01-02 NaN
2006-01-03 NaN
TD 2016-09-22 57.139340
2016-09-23 57.171864
In [11]: d.groupby(level='ticker').apply(lambda x: x.rolling(30).mean())
Out[11]:
ticker date
BMO 2006-01-02 NaN
2006-01-03 NaN
TD 2016-09-22 57.139340
2016-09-23 57.171864
I would expect the output to be the same in all three cases.
Metadata
Metadata
Assignees
Labels
BugDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestGroupbyReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode