-
-
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 bins empty groups #1027
Conversation
# one of these bins will be empty | ||
bins = [0,4,5] | ||
actual = array.groupby_bins('dim_0', bins, drop_empty_bins=True).sum() | ||
print(actual) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prob don't want to keep this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops! yes forgot to take that out
Rather than adding a new keyword argument, I'm inclined to unilaterally set |
@shoyer So do you want the keyword argument dropped altogether? Or just the default changed (as in my last commit)? I can imagine wanting to drop the empty bins in some cases, but not as default. So I would vote to keep the keyword argument. |
Yeah my inclination would be not to add the option at all.
|
I guess it's pretty easy to just do |
Just for future readers like me: the point of this PR is to make |
@fmaussion it's a little more involved than that...see edited description. |
Thanks! |
* fixes #1027 * reviews + whats new * wrong commit
This PR fixes a bug in
groupby_bins
in which empty bins were dropped from the grouped results. Nowgroupby_bins
restores any empty bins automatically. To recover the old behavior, one could applydropna
after a groupby operation.Fixes #1019