Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: Implement PDEP-17#61468

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

Already on GitHub?Sign in to your account

Open
rhshadrach wants to merge4 commits intopandas-dev:main
base:main
Choose a base branch
Loading
fromrhshadrach:implement_pdep17

Conversation

rhshadrach
Copy link
Member

@rhshadrachrhshadrach commentedMay 20, 2025
edited
Loading

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • Allcode checks passed.
  • Addedtype annotations to new arguments/methods/functions.
  • Added an entry in the latestdoc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Continuation of#58169

Still needs tests and some cleanup with the docs and decorator arguments, but I'd like to get a first look.

cc@Dr-Irv@Aloqeely

Comment on lines 94 to 97
classPandasChangeWarning(Warning):
"""
Warning raised for any an upcoming change.
"""
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Not in love with this name, butPandasDeprecationWarning is taken below. Bikeshedding here is most welcome!

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We could also make this internal if we want to not have it be public.

@rhshadrachrhshadrach added this to the3.0 milestoneMay 20, 2025
@rhshadrachrhshadrach added Enhancement WarningsWarnings that appear or should be added to pandas PDEPpandas enhancement proposal labelsMay 20, 2025
@datapythonistadatapythonista removed the PDEPpandas enhancement proposal labelMay 20, 2025
@datapythonista
Copy link
Member

Seems like the labelPDEP can only be used for the PDEP themselves. Otherwise building the website fails, as it expects the PR to be a PDEP that needs to be rendered in the roadmap.

rhshadrach reacted with thumbs up emoji

Copy link
Contributor

@Dr-IrvDr-Irv left a comment

Choose a reason for hiding this comment

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

I think there should be separate docs about the deprecation policy and these classes, aside from what is in the whatsnew document.

@@ -24,6 +24,12 @@ Enhancement1
Enhancement2
^^^^^^^^^^^^

New Deprecation Policy
^^^^^^^^^^^^^^^^^^^^^^
pandas 3.0.0 introduces a new 3-stage deprecation policy: using ``DeprecationWarning`` initially, then switching to ``FutureWarning`` for broader visibility in the last minor version before the next major release, and then removal of the deprecated functionality in the major release.
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we say that these could be tested via the classesPandasDeprecationWarning andPandasFutureWarning ?

Comment on lines +154 to +180
classPandas4Warning(PandasDeprecationWarning):
"""
Warning raised for an upcoming change that will be enforced in pandas 4.0.
See Also
--------
errors.Pandas4Warning : Class for deprecations to be enforced in pandas 4.0.
Examples
--------
>>> pd.errors.Pandas4Warning
<class 'pandas.errors.Pandas4Warning'>
"""


classPandas5Warning(PandasPendingDeprecationWarning):
"""
Warning raised for an upcoming change that will be enforced in pandas 5.0.
See Also
--------
errors.Pandas4Warning : Class for deprecations to be enforced in pandas 4.0.
Examples
--------
>>> pd.errors.Pandas5Warning
<class 'pandas.errors.Pandas5Warning'>
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should have an abstract base classPandasWarning that has an abstract class methodversion(), and then bothPandas4Warning andPandas5Warning inherit from that class as well, and defineversion() to return 4 and 5 respectively.

Then indeprecate_nonkeyword_arguments(), instead of checking for the class, you just check forversion(). See comment there.

Comment on lines +292 to +301
frompandas.errorsimport (
Pandas4Warning,
Pandas5Warning,
)

ifklassisPandas4Warning:
version="4.0"
elifklassisPandas5Warning:
version="5.0"
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

If you create the ABCPandasWarning as suggested above, then you could just do

ifissubclass(klass,PandasWarning):version=klass.version()else:raiseAssertionError(f"{type(klass)=} must be a versioned warning")

@@ -51,6 +51,12 @@ Exceptions and warnings
errors.OptionError
errors.OutOfBoundsDatetime
errors.OutOfBoundsTimedelta
errors.PandasChangeWarning
errors.Pandas4Warning
errors.Pandas5Warning
Copy link
Contributor

Choose a reason for hiding this comment

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

Aside from the tests,Pandas5Warning isn't used. Is the idea that we will use it in the future?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yes.

@rhshadrach
Copy link
MemberAuthor

@Dr-Irv - Thanks for the review! I'm negative on the namePandasWarning for a class that has to do with deprecations. pandas emits many warnings, not all are about deprecations.

@Dr-Irv
Copy link
Contributor

@Dr-Irv - Thanks for the review! I'm negative on the namePandasWarning for a class that has to do with deprecations. pandas emits many warnings, not all are about deprecations.

Maybe a different name would solve that? MaybePandasDeprecationOrFutureWarning or something like that.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Dr-IrvDr-IrvDr-Irv requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
EnhancementWarningsWarnings that appear or should be added to pandas
Projects
None yet
Milestone
3.0
Development

Successfully merging this pull request may close these issues.

4 participants
@rhshadrach@datapythonista@Dr-Irv@Aloqeely

[8]ページ先頭

©2009-2025 Movatter.jp