DEPR fill_method and limit keywords in pct_change by Charlie-XIAO · Pull Request #53520 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation16 Commits16 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

Charlie-XIAO

rhshadrach

Choose a reason for hiding this comment

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

This would be good if the default for fill_method was None. However, it is currently "pad". When the deprecation is enforced, I think we'll want the behavior to be None instead. This means we first need to deprecate/change the result, and then once that's done we can deprecate the argument.

@Charlie-XIAO

Can these be done in a single PR or in separate PRs?

@rhshadrach

I don't think these can be done in a single major version. In 2.x we deprecate the default; in 3.x we can then change the default to None. Finally in 3.x we can also deprecate the arguments and in 4.x we can remove them.

@Charlie-XIAO

@rhshadrach I have updated the PR to deprecate only the default value of fill_method. Not sure if I'm doing correctly, so please let me know if I should make changes.

It also seems that deprecating this behavior is raising warnings in so many tests. I've already fixed some of those, do I need to fix the rest as well (like what I'm currently doing), or is there a better resolution?

@Charlie-XIAO Charlie-XIAO changed the titleDEPR fill_method and limit keywords in pct_change DEPR default value of fill_method in pct_change

Jun 5, 2023

@jbrockmendel

I disagree with @rhshadrach that this needs to be a two-major-version process. This is just not that big of a deal.

@rhshadrach

@jbrockmendel

  1. warn if method is explicitly passed
  2. otherwise warn if there are NAs present

@rhshadrach

Ah - thanks; that sounds great to me.

@Charlie-XIAO

Okay, so in other words, revert to my original version, and in addition warn when has NA but method is not explicit passed.

I will make the changes soon. Thanks for your discussion.

@Charlie-XIAO Charlie-XIAO changed the titleDEPR default value of fill_method in pct_change DEPR fill_method and limit keywords in pct_change

Jun 8, 2023

@Charlie-XIAO

rhshadrach

Choose a reason for hiding this comment

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

lgtm

@mroeschke

Could you merge main once more?

@Charlie-XIAO

mroeschke

@mroeschke

Daquisu pushed a commit to Daquisu/pandas that referenced this pull request

Jul 8, 2023

@Charlie-XIAO

…3520)

This reverts commit 2cb449b.

@holymonson

@rhshadrach @jbrockmendel Hi, we need fill_method='None' to force pct_change not to handle NAs, but this PR cause a lot of deprecated warning and we can't fix it. Before you provide an alternative to do that, deprecatingfill_method is unwise.

@Charlie-XIAO

Does obj.fillna(...).pct_change not work, as is also mentioned in the deprecation message? @holymonson

@holymonson

Does obj.fillna(...).pct_change not work, as is also mentioned in the deprecation message? @holymonson

We don't want fillna() at all, on the contrary we want keeping NAs, while your deprecation message doesn't tell howto NOT fillna.

@rhshadrach