maxframe.liteframe.LiteFrame.str.split#
- LiteFrame.str.split(pat: str | Pattern | None = None, *, n=-1, expand: bool = False, regex: bool | None = None)#
Split strings around given separator/delimiter.
Splits the string in the Series/Index from the beginning, at the specified delimiter string.
- Parameters:
pat (str or compiled regex, optional) – String or regular expression 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) –
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) –
Determines if the passed-in pattern is a regular expression:
If
True, assumes the passed-in pattern is a regular expressionIf
False, treats the pattern as a literal string.If
Noneand pat length is 1, treats pat as a literal string.If
Noneand pat length is not 1, treats pat as a regular expression.Cannot be set to False if pat is a compiled regex
- Returns:
Type matches caller unless
expand=True(see Notes).- Return type:
- Raises:
if regex is False and pat is a compiled regex
See also
LiteFrame.str.splitSplit strings around given separator/delimiter.
LiteFrame.str.rsplitSplits string around given separator/delimiter, starting from the right.
LiteFrame.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.Use of regex =False with a pat as a compiled regex will raise an error.