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

Fix FutureWarning for DataFrameGroupBy.grouper #193

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

jrycw
Copy link
Contributor

@jrycw jrycw commented Feb 14, 2024

There's a future warning displayed in the stub:

FutureWarning: DataFrameGroupBy.grouper is deprecated and will be removed in a future version of pandas.

More details related to this warning can be found in the Pandas v2.2.0 release notes and issue GH 56521.

Instead of using g_df.grouper.indices, it might be better to directly use g_df.indices. By using g_df.indices, we shouldn't encounter any backward compatibility issues IMO.

BTW, if we don't really need the values as a list type, directly returning data.groupby(group_key).indices might be another option.

Copy link
Collaborator

@machow machow left a comment

Choose a reason for hiding this comment

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

Nice catch, thanks! It looks like this indices method has been around for a while, so should be okay to use!

@machow machow merged commit 8c70a6d into posit-dev:main Feb 14, 2024
7 checks passed
@jrycw jrycw deleted the fix-stub branch February 14, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants