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 pandas FutureWarnings in calls to .groupby() #1164

Merged
merged 3 commits into from
Apr 22, 2024

Conversation

dw-610
Copy link

@dw-610 dw-610 commented Apr 20, 2024

Problem

Currently, with pandas version 2.2.2, calls to .groupby() raise the warning below:

FutureWarning: The default of observed=False is deprecated and will be changed to True in a future version of pandas. Pass observed=False to retain current behavior or observed=True to adopt the future default and silence this warning.

Solution

To retain current behavior and silence this warning, observed=False was added to all calls to .groupby()

…rrent behavior and silence the pandas FutureWarning

Signed-off-by: Dylan W <139509928+dw-610@users.noreply.github.com>
@@ -256,7 +256,7 @@
},
{
"data": {
Copy link
Member

Choose a reason for hiding this comment

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

can you avoid making changes to the "data" field?
you can do by checking out the remote version of this file and only changing the groupby line.

Copy link
Member

@amit-sharma amit-sharma left a comment

Choose a reason for hiding this comment

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

Thanks for these changes @dw-610 They look good to merge, but there's a minor comment I made inline. Can you take a look at that and avoid major changes to the notebook file?

dw-610 added 2 commits April 22, 2024 07:48
…ta' field

Signed-off-by: Dylan W <139509928+dw-610@users.noreply.github.com>
…rning

Signed-off-by: Dylan W <139509928+dw-610@users.noreply.github.com>
@dw-610 dw-610 force-pushed the fix-pandas-futurewarnings branch from 722ca98 to 58960e0 Compare April 22, 2024 12:49
@dw-610
Copy link
Author

dw-610 commented Apr 22, 2024

Thanks for the feedback @amit-sharma

The issue should be resolved now.

@amit-sharma
Copy link
Member

Thanks! @all-contributors please add @dw-610 for code

Copy link
Contributor

@amit-sharma

I've put up a pull request to add @dw-610! 🎉

@amit-sharma amit-sharma merged commit 37dd304 into py-why:small-cleanups Apr 22, 2024
1 check passed
@dw-610 dw-610 deleted the fix-pandas-futurewarnings branch April 22, 2024 16:10
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.

2 participants