Skip to content

DOC: Clarify str.cat output for Index object (GH35556) #61833

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anvivats
Copy link

@anvivats anvivats commented Jul 11, 2025

  • closes DOC: .str.cat output in case of Index object #35556
  • Tests added and passed — N/A (doc-only change)
  • All code checks passed — pre-commit and CI should pass
  • Added type annotations — N/A (no new code added)
  • Added an entry in the latest whatsnew — N/A (doc-only update)

Summary of Changes

This PR improves the docstring for str.cat() to clarify what happens when the caller is an Index and others is None.

Specifically, the doc now explains that in this case, the output is also an Index containing a single string, rather than a plain str as it is for Series.

Example added:

>>> idx = pd.Index(["a", "b", np.nan])
>>> idx.str.cat(sep="-")
Index(['a-b'], dtype='object')

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.

DOC: .str.cat output in case of Index object
1 participant