Skip to content

CLN: Cleanups in groupby due to numeric_only deprecations #49761

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

Merged

Conversation

rhshadrach
Copy link
Member

@rhshadrach rhshadrach commented Nov 18, 2022

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Summary:

  • For ops that call _op_via_apply, numeric_only being None or lib.no_default is the same as False since these just call the corresponding DataFrame methods where the deprecation has already been enforced
  • The above remark also applies for idxmin/idxmax
  • Where we set ignore_failures=numeric_only is lib.no_default, across groupby numeric_only=lib.no_defualt is internally treated as numeric_only=True, so there is no reason to ignore failures.
  • In the one test change, this is where groupby attempts to default to numeric_only=True but as this results in an empty frame the op instead defaults to numeric_only=False. For the whatsnew, this will be covered by the general message that groupby will no longer automatically drop nuisance columns.

@rhshadrach rhshadrach changed the title Enforce groupby numeric only none CLN: Cleanups in groupby due to numeric_only deprecations Nov 18, 2022
@rhshadrach rhshadrach added Groupby Nuisance Columns Identifying/Dropping nuisance columns in reductions, groupby.add, DataFrame.apply Clean labels Nov 18, 2022
@rhshadrach rhshadrach added this to the 2.0 milestone Nov 18, 2022
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

LGTM. Just a merge conflict

rhshadrach and others added 7 commits November 19, 2022 12:17
…m/rhshadrach/pandas into enforce_groupby_numeric_only_none

� Conflicts:
�	pandas/core/groupby/generic.py
�	pandas/core/groupby/groupby.py
�	pandas/tests/groupby/test_function.py
�	pandas/tests/groupby/test_groupby.py
@rhshadrach rhshadrach requested a review from mroeschke November 22, 2022 00:41
@mroeschke mroeschke merged commit 2f751ad into pandas-dev:main Nov 22, 2022
@mroeschke
Copy link
Member

Thanks @rhshadrach

@rhshadrach rhshadrach deleted the enforce_groupby_numeric_only_none branch November 22, 2022 03:23
mliu08 pushed a commit to mliu08/pandas that referenced this pull request Nov 27, 2022
…#49761)

* DEPR: Enforce deprecation of dropping columns when numeric_only=False in groupby / resample

* Change to TypeError

* Better error message

* WIP

* WIP

* CLN: Cleanups in groupby due to numeric_only deprecations

* revert

* Remove ops from groupby.String

* fixup

* fixup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Groupby Nuisance Columns Identifying/Dropping nuisance columns in reductions, groupby.add, DataFrame.apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants