-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
groupby should still squeeze for non-monotonic inputs #1460
Comments
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity If this issue remains relevant, please comment here or remove the |
I'd like add that the groupby docstring never mention that squeezing only works for monotonic index (which is an unreasonable restriction in the first place) |
A better long term solution is probably removing "squeeze" from groupby entirely: #2157 |
Just wanted to mention I just got tripped up by this. It took me a long time to figure out why my code wasn't working like the groupby example. It took a lot of trial and error to figure out the problem was one of my dims wasn't sorted. It was a categorical string-based dim that you wouldn't think to sort. I personally find squeeze a convenient option when applying map. FWIW, it would break some of my code if the default behavior were to change (I'm using map to apply some mathematical code that expects 2d matrix input. The DataArray is 3D, where the third dimension is a label for each 2d matrix). Easy to adapt the code, but I wanted to point out a case where squeeze is what you want. |
Well, even if we keep |
Closes pydata#9279 Closes pydata#1460 Closes pydata#2157
Closes pydata#9279 Closes pydata#1460 Closes pydata#2157
Closes pydata#9279 Closes pydata#1460 Closes pydata#2157
Closes pydata#9279 Closes pydata#1460 Closes pydata#2157
We can simply use
argsort()
to determinegroup_indices
instead ofnp.arange()
:xarray/xarray/core/groupby.py
Line 256 in 22ff955
The text was updated successfully, but these errors were encountered: