-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
groupby.nth() labelling conventions changed from 0.17 -> 0.18 #13666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like there are similar issues for other resampling frequencies: Weekly resample in 0.17:
Weekly resample in 0.18:
|
M is the offset for month end |
I don't think this has to do with the resampling frequency, rather with a change in
In 0.17, the index you see in the
The problem with this is that this only seems to work with Series (if I use the original Series example, you get an error). |
I could see use-cases for getting the group label (the current behavior) or for getting the label of the selected row (the old behavior), but I would expect that to be an argument to
|
@ssanderson Note that |
The current behavior appears correct. I think the only thing left in this issue is @jorisvandenbossche's comment that
|
Looking at this again, with the exception of
This is not a reducer as group I think nth should have the result of a filter here, namely
|
Does it make sense for |
But nth does not aggregate. Only
is an empty DataFrame. This is not an aggregation. pandas has (mostly 😆) well-defined behavior on how aggregations vs filters vs transformations should behave and |
Hi, the change to the |
@cantudiaz - can you give an example you are trying to replace? If you are using in-axis groupings, you can call
|
Thanks, @rhshadrach. I think your suggestion works. |
In pandas 0.17.1, grouping a DatetimeIndex with monthly frequency produced labels keyed at the start of the month, and
nth()
produces a label keyed by the selected row. In 0.18, we unconditionally return groups labelled by the end of the month.Old Pandas
Latest Pandas
Expected Output
I expect the behavior from 0.17.1.
The text was updated successfully, but these errors were encountered: