-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
API: future.default_arg
for method-specific behavior changes
#60593
Comments
future.default
for method-specific behavior changesfuture.default_arg
for method-specific behavior changes
cc @pandas-dev/pandas-core |
I like this idea, and there is a bit of precedent (just discovered this yesterday) with Having said that, if we want to do this each time we make behavior changes, then maybe this proposal should be a PDEP? |
I personally do not think this rises to the level of a PDEP. |
My reason for suggesting that is because it then becomes a "policy" that we follow going forward |
How would someone manage |
What is the off-ramp for changing this? Do we always support future=False to retain the legacy behaviour? Or is there an expectation that after the default changes, any bool atgument will start warning that the future behaviour will become the only behaviour, and the future keyword will be removed? |
Understood - I just think "something becoming policy" is not in and of itself sufficient for requiring a PDEP.
We don't. The purpose of the underride is for people who are not trying to maintain code that needs to work across changes in major versions of pandas. If you are maintaining code across major versions of pandas, you should only be using the default of
The latter. I think the entire deprecation process would look like the following:
|
IMHO, the PDEP is the best way for us to document how we want to move forward with similar changes in the future. This particular idea (which I support) is related to the deprecation policy PDEP-17 that we recently approved. So if we make it a PDEP, then we have that reference going forward for similar issues in the future. |
PDEP-1 starts with
This is not a major change. We have contributor docs for documentation, not PDEPs. |
It's not a major change in the code, but a change in how we will handle these kinds of deprecations. I agree that it's borderline on whether it should be a PDEP or not. |
I would be +1 to a PDEP for this. It would also be a good supplement to PDEP-17 |
Ref: #60551 (comment)
Whenever possible, a deprecation should be performed without the introduction of a new argument for performing said deprecation. However there are times where we are changing the behavior of an existing function or method where the output will change on the same set of input arguments. For this, I think pandas should have a standard way of modifying the existing behavior.
I think there are two common cases when using pandas:
I think we can support both use cases by:
future=[True | False | no_default]
defaulting tono_default
.future=True
gives the future behavior after the deprecation will be enforced.future=False
gives the current behavior, with no warning message.future=no_default
gives a warning messagefuture.default_arg = [True | False | no_default]
defaulting tono_default
.When e.g.
df.method(...)
is called without specifying the value offuture
, only then will the valuefuture.default_arg
will be used.Users can keep the current behavior and globally disable all warnings by specifying
future.default_arg = False
. If they were to do so and upgrade across major versions of pandas, they will see breaking changes without ever getting any warnings. As such, I think the documentation on this should read something like:The text was updated successfully, but these errors were encountered: