Skip to content
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

DEPR: observed=False default in groupby #51811

Merged
merged 10 commits into from
Mar 17, 2023

Conversation

rhshadrach
Copy link
Member

@rhshadrach rhshadrach commented Mar 7, 2023

@rhshadrach rhshadrach added Groupby Categorical Categorical Data Type Deprecate Functionality to remove in pandas labels Mar 7, 2023
@rhshadrach rhshadrach added this to the 2.1 milestone Mar 7, 2023
@topper-123
Copy link
Contributor

for users who work interaactively (ipython, jupyter,..), Is there way to avoid the FutureWarning coming repeatedly? It will probably get quite annoying after a while...

Otherwise LGTM.

@rhshadrach
Copy link
Member Author

Thanks @topper-123

for users who work interaactively (ipython, jupyter,..), Is there way to avoid the FutureWarning coming repeatedly? It will probably get quite annoying after a while...

Users can specify observed=True|False. Also, just to be sure, this will only warn if one of the groupings is categorical.

I think you're thinking of some global option? I would be -1 on that, and hope this will be rare enough that it won't pester users. They'll need to specify observed=True if they want to adopt future behavior or observed=False if they want to maintain current behavior eventually.

@@ -93,10 +93,10 @@ Other API changes
Deprecations
~~~~~~~~~~~~
- Deprecating pinning ``group.name`` to each group in :meth:`SeriesGroupBy.aggregate` aggregations; if your operation requires utilizing the groupby keys, iterate over the groupby object instead (:issue:`41090`)
- Deprecated the default of ``observed=False`` in :meth:`DataFrame.groupby` and :meth:`Series.groupby` (:issue:`43999`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you mention this will be True in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call - done.

@mroeschke mroeschke merged commit 0baa925 into pandas-dev:main Mar 17, 2023
@mroeschke
Copy link
Member

Thanks @rhshadrach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Deprecate Functionality to remove in pandas Groupby
Projects
None yet
3 participants