-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN/DOC: _selected_obj vs _obj_with_exclusions #46944
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
Current behavior
I don't have a good reason why both of these objects should exist, so I don't think I can say when to use one over the other. I have similar thoughts about |
To the
where |
My intuition is to go the other direction. The statefulness of _group_selection_context makes things way more difficult to reason about. I'd want to move away from that. Without that context, the two are almost identical. AFAICT we can eliminate the For the other usages of _group_selection_context, using obj_with_exclusions instead of selected_obj lets us remove the context without breaking any tests. |
Once #50846 is merged, any place in the tests where a groupby object is created, Until some behavior is deprecated (especially in apply), we won't be able to remove selected_obj. I agree we should be also removing the context - my thought is to remove obj_with_exclusions and then invert the
|
It looks like with group_selection_context enabled, _selected_obj (with the fix in #50846) is equivalent to _obj_with_exclusions except for cases where |
Rethinking this, I'd prefer to have both |
After some more sleuthing, in order for the two to not-match: In addition to self._selection being a scalar, self.obj needs to not be a Series, and For SeriesGroupBy and DataFrameGroupBy, the only way |
@rhshadrach are we at a point where we can remove one of these? |
Here is an inventory of usages of
For filters, plotting, and iteration (and others), I wonder if we can instead subset |
In the groupby code, when do/should we use self._obj_with_exclusions vs self._selected_obj?
The text was updated successfully, but these errors were encountered: