Skip to content

API: Avoid returning same object for various methods #51032

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

Merged
merged 4 commits into from
Jan 31, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Jan 27, 2023

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

cc @jorisvandenbossche

@jorisvandenbossche jorisvandenbossche changed the title CLN: Avoid returning same object for various methods Jan 30, 2023
@jorisvandenbossche
Copy link
Member

We should note this as an API change, I think (which it strictly speaking is), but personally I think that would be a good change for 2.0. It would be nice to have the general rule that a method that typically returns a new series/dataframe never returns self, even if no changes were needed.

Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

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

needs whatnsew per joris's suggestion, otherwise LGTM

@phofl
Copy link
Member Author

phofl commented Jan 30, 2023

Added a note

@jorisvandenbossche jorisvandenbossche added this to the 2.0 milestone Jan 31, 2023
@jorisvandenbossche jorisvandenbossche merged commit c73736c into pandas-dev:main Jan 31, 2023
@jorisvandenbossche
Copy link
Member

Thanks!

@phofl phofl deleted the return_self branch January 31, 2023 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants