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
works, but it would be nice to unify the interfaces: resample accepts level and on for index and column respectively, while rolling accepts on for both.
The text was updated successfully, but these errors were encountered:
Continuing the method chain with something like .sum gives us:
category category date
A A 2021-01-01 00:00:00 1.0
2021-01-01 01:00:00 2.0
2021-01-01 02:00:00 3.0
2021-01-01 03:00:00 4.0
2021-01-01 04:00:00 5.0
... ...
B B 2021-01-04 20:00:00 24.0
2021-01-04 21:00:00 24.0
2021-01-04 22:00:00 24.0
2021-01-04 23:00:00 24.0
2021-01-05 00:00:00 24.0
[97 rows x 1 columns]
I thought the repeated category in the index might have been buggy but from discussions in #38737 maybe it is by design.
Happy to take this one, make changes and write tests, if I'm on the right track, but perhaps there needs to be a decision around whether the rolling should use a "level" parameter for index names (to be consistent with resample) as @metazoic suggested
Thanks for the report @metazoic. We have a similar request in #34642, so I'm going to consolidate the discussion to that issue and close this one. Happy to have a pull request implementing this feature.
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
If
then
breaks with
Problem description
The documentation states that the
on
argument can be aMultiIndex
level (and then confusingly adds "rather than the DataFrame's index").Expected Output
rolling
should accept aMultiIndex
level. Interestingly,works, but it would be nice to unify the interfaces:
resample
acceptslevel
andon
for index and column respectively, whilerolling
acceptson
for both.The text was updated successfully, but these errors were encountered: