8000 Groupby agg works with pd.Series.nunique, but groupby nunique fails with axis=1 by Ynob2000 · Pull Request #30311 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Groupby agg works with pd.Series.nunique, but groupby nunique fails with axis=1 #30311

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 11 commits into from
Dec 18, 2019
Prev Previous commit
Next Next commit
Update pandas/core/groupby/grouper.py
Thanks to Tom for the tip

Co-Authored-By: Tom Augspurger <TomAugspurger@users.noreply.github.com>
  • Loading branch information
Ynob2000 and TomAugspurger authored Dec 12, 2019
commit 7651314123d738e37daeb821d0c024acb4601648
2 changes: 1 addition & 1 deletion pandas/core/groupby/grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def get_grouper(
raise ValueError("multiple levels only valid with MultiIndex")

if isinstance(level, str):
axis_name = obj._get_axis_name(axis)
if obj._get_axis(axis) != level:
if getattr(obj, axis_name).name != level:
raise ValueError(
f"level name {level} is not the name of the {axis_name}"
Expand Down
0