Skip to content

Conversation

@Lakshya-Upadhyaya
Copy link
Contributor

- Add Pandas4Warning when Series is passed to Index.join
- Add test for deprecation warning
- Update whatsnew for v3.0.0
Closes pandas-dev#62897
"""
if not isinstance(other, Index):
warnings.warn(
f"Passing a Series to {type(self).__name__}.join is deprecated "
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

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.

- 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`)
Copy link
Member

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

@jbrockmendel jbrockmendel merged commit ede9a18 into pandas-dev:main Nov 4, 2025
42 checks passed
@jbrockmendel
Copy link
Member

thanks @Lakshya-Upadhyaya

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Index.join works when other is Series, giving Index

2 participants