Skip to content

ENH: Add numeric_only to certain groupby ops #46728

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
merged 16 commits into from
Apr 30, 2022
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
f7b76f2
ENH: Add numeric_only to certain groupby ops
rhshadrach Apr 10, 2022
d6129de
Merge branch 'main' of https://github.com/pandas-dev/pandas into add_…
rhshadrach Apr 10, 2022
d434816
Fix type-hint
rhshadrach Apr 11, 2022
ebf777a
test fixup
rhshadrach Apr 11, 2022
bb424ba
Merge branch 'main' of https://github.com/pandas-dev/pandas into add_…
rhshadrach Apr 11, 2022
de2e7b3
Merge branch 'main' of https://github.com/pandas-dev/pandas into add_…
rhshadrach Apr 14, 2022
58e9ddc
fixup
rhshadrach Apr 14, 2022
134313e
Merge branch 'main' of https://github.com/pandas-dev/pandas into add_…
rhshadrach Apr 15, 2022
6921c94
Merge branch 'add_numeric_only_gb' of https://github.com/rhshadrach/p…
rhshadrach Apr 15, 2022
8e435ab
Merge branch 'main' of https://github.com/pandas-dev/pandas into add_…
rhshadrach Apr 19, 2022
bc53f90
Merge branch 'main' of https://github.com/pandas-dev/pandas into add_…
rhshadrach Apr 21, 2022
88caf9b
Simplify var
rhshadrach Apr 23, 2022
f2bee5f
Merge branch 'main' of https://github.com/pandas-dev/pandas into add_…
rhshadrach Apr 23, 2022
dbd81cd
fixup
rhshadrach Apr 28, 2022
b176238
Merge branch 'main' of https://github.com/pandas-dev/pandas into add_…
rhshadrach Apr 28, 2022
c79c700
fixup
rhshadrach Apr 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup
  • Loading branch information
rhshadrach committed Apr 28, 2022
commit dbd81cd27304c77ec44b8eafcc4d7c3ef5c3e161
5 changes: 2 additions & 3 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -2153,20 +2153,19 @@ def var(

return self._numba_agg_general(sliding_var, engine_kwargs, ddof)
else:
ignore_failures = numeric_only is lib.no_default or numeric_only
numeric_only = self._resolve_numeric_only(numeric_only)
if ddof == 1:
return self._cython_agg_general(
"var",
alt=lambda x: Series(x).var(ddof=ddof),
numeric_only=numeric_only,
ignore_failures=ignore_failures,
ignore_failures=False,
)
else:
func = lambda x: x.var(ddof=ddof)
with self._group_selection_context():
return self._python_agg_general(
func, raise_on_typeerror=not ignore_failures
func, raise_on_typeerror=not numeric_only
)

@final
Expand Down