-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
DEPR: deprecate passing Series to Index.join #62948
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
DEPR: deprecate passing Series to Index.join #62948
Conversation
- Add Pandas4Warning when Series is passed to Index.join - Add test for deprecation warning - Update whatsnew for v3.0.0 Closes pandas-dev#62897
pandas/core/indexes/base.py
Outdated
| """ | ||
| if not isinstance(other, Index): | ||
| warnings.warn( | ||
| f"Passing a Series to {type(self).__name__}.join is deprecated " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message will only be correct for a Series other, but the condition is only for non-Index. can you either make the message more general or condition more specific
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the input! Should I drop support for just Series (since that's what the issue references), or for all non-Index types (to be consistent with the signature that states other: Index)?
I'll take the specific option (isinstance(other, Series)), unless you prefer the general option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id deprecate for all non-Index objects.
doc/source/whatsnew/v3.0.0.rst
Outdated
| - Deprecated allowing ``fill_value`` that cannot be held in the original dtype (excepting NA values for integer and bool dtypes) in :meth:`Series.shift` and :meth:`DataFrame.shift` (:issue:`53802`) | ||
| - Deprecated backward-compatibility behavior for :meth:`DataFrame.select_dtypes` matching "str" dtype when ``np.object_`` is specified (:issue:`61916`) | ||
| - Deprecated option "future.no_silent_downcasting", as it is no longer used. In a future version accessing this option will raise (:issue:`59502`) | ||
| - Deprecated passing a :class:`Series` to :meth:`Index.join`, pass ``Index.join(other.index)`` instead (:issue:`62897`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you update this line to reflect that it is any non-Index and not just Series
|
thanks @Lakshya-Upadhyaya |
Add Pandas4Warning when Series is passed to Index.join
Add test for deprecation warning
Update whatsnew for v3.0.0 Closes BUG:
Index.joinworks whenotherisSeries, givingIndex#62897closes BUG:
Index.joinworks whenotherisSeries, givingIndex#62897Tests 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.rstfile if fixing a bug or adding a new feature.