modin.pandas.Series.str.split¶
- Series.str.split(pat=None, *, n=- 1, expand=False, regex=None)[source]¶
Split strings around given separator/delimiter.
Splits the string in the Series/Index from the beginning, at the specified delimiter string.
- Parameters:
pat (str, optional) – String to split on. If not specified, split on whitespace.
n (int, default -1 (all)) – Limit number of splits in output. None, 0 and -1 will be interpreted as return all splits.
expand (bool, default False (Not implemented yet, should be set to False)) – Expand the split strings into separate columns. - If True, return DataFrame/MultiIndex expanding dimensionality. - If False, return Series/Index, containing lists of strings.
regex (bool, default None (Not implemented yet, should be set to False or None)) – Determines if the passed-in pattern is a regular expression: - If True, assumes the passed-in pattern is a regular expression - If False or None, treats the pattern as a literal string.
- Returns:
Type matches caller unless expand=True (see Notes).
- Return type:
See also
Series.str.splitSplit strings around given separator/delimiter.
Series.str.rsplitSplits string around given separator/delimiter, starting from the right.
Series.str.joinJoin lists contained as elements in the Series/Index with passed delimiter.
str.splitStandard library version for split.
str.rsplitStandard library version for rsplit.
Notes
The handling of the n keyword depends on the number of found splits:
If found splits > n, make first n splits only
If found splits <= n, make all splits
If for a certain row the number of found splits < n, append None for padding up to n if expand=True
If using expand=True, Series and Index callers return DataFrame and MultiIndex objects, respectively.
Examples
In the default setting, the string is split by whitespace.
The n parameter can be used to limit the number of splits on the delimiter.
The pat parameter can be used to split by other characters.
When using expand=True, the split elements will expand out into separate columns. If NaN is present, it is propagated throughout the columns during the split.