File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -608,14 +608,25 @@ def cat(
608
608
dtype: object
609
609
>>>
610
610
>>> s.str.cat(t, join="right", na_rep="-")
611
- 3 dd
612
- 0 aa
613
- 4 -e
614
- 2 -c
615
- dtype: object
611
+ 3 dd
612
+ 0 aa
613
+ 4 -e
614
+ 2 -c
615
+ dtype: object
616
+
617
+ When calling `.str.cat()` on an Index and not passing `others`, the return value is an Index:
618
+
619
+ >>> idx = pd.Index(["x", "y", np.nan])
620
+ >>> idx.str.cat(sep="-")
621
+ Index(['x-y'], dtype='object')
622
+
623
+ Note
624
+ ----
625
+ Calling `.str.cat()` on a Series returns a string if `others` is None,
626
+ but when called on an Index, it returns a new Index containing the concatenated string.
627
+
628
+ For more examples, see :ref:`here <text.concatenate>`.
616
629
617
- For more examples, see :ref:`here <text.concatenate>`.
618
- """
619
630
# TODO: dispatch
620
631
from pandas import (
621
632
Index,
You can’t perform that action at this time.
0 commit comments