@@ -1116,9 +1116,8 @@ def str_split(arr, pat=None, n=None):
11161116
11171117 Returns
11181118 -------
1119- split : Series/Index or DataFrame/MultiIndex of objects
1120- Type matches caller unless ``expand=True`` (return type is DataFrame or
1121- MultiIndex)
1119+ Series, Index, DataFrame or MultiIndex
1120+ Type matches caller unless ``expand=True`` (see Notes).
11221121
11231122 Notes
11241123 -----
@@ -1129,6 +1128,16 @@ def str_split(arr, pat=None, n=None):
11291128 - If for a certain row the number of found splits < `n`,
11301129 append `None` for padding up to `n` if ``expand=True``
11311130
1131+ If using ``expand=True``, Series and Index callers return DataFrame and
1132+ MultiIndex objects, respectively.
1133+
1134+ See Also
1135+ --------
1136+ str.split : Standard library version of this method.
1137+ Series.str.get_dummies : Split each string into dummy variables.
1138+ Series.str.partition : Split string on a separator, returning
1139+ the before, separator, and after components.
1140+
11321141 Examples
11331142 --------
11341143 >>> s = pd.Series(["this is good text", "but this is even better"])
@@ -1145,8 +1154,10 @@ def str_split(arr, pat=None, n=None):
11451154 1 [but this is even better]
11461155 dtype: object
11471156
1148- When using ``expand=True``, the split elements will
1149- expand out into separate columns.
1157+ When using ``expand=True``, the split elements will expand out into
1158+ separate columns.
1159+
1160+ For Series object, output return type is DataFrame.
11501161
11511162 >>> s.str.split(expand=True)
11521163 0 1 2 3 4
@@ -1157,6 +1168,13 @@ def str_split(arr, pat=None, n=None):
11571168 0 this good text
11581169 1 but this even better
11591170
1171+ For Index object, output return type is MultiIndex.
1172+
1173+ >>> i = pd.Index(["ba 100 001", "ba 101 002", "ba 102 003"])
1174+ >>> i.str.split(expand=True)
1175+ MultiIndex(levels=[['ba'], ['100', '101', '102'], ['001', '002', '003']],
1176+ labels=[[0, 0, 0], [0, 1, 2], [0, 1, 2]])
1177+
11601178 Parameter `n` can be used to limit the number of splits in the output.
11611179
11621180 >>> s.str.split("is", n=1)
0 commit comments