pandas.Series.str.split
pandas 3.1.1 · Series and accessors · method
Split each string at a delimiter or pattern. Use expand=True to place parts in separate columns.
Call syntax
Series.str.split(pat=None, *, n=-1, expand=False, regex=None)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
pat |
Optional Positional or keyword Default None |
str or compiled regex Choose the separator. With the default None, pandas splits on whitespace. |
n |
Optional Keyword only Default -1 |
int Limit the number of splits per value. The usual default allows every match to split. |
expand |
Optional Keyword only Default False |
bool Choose whether to expand extracted pieces into separate columns. |
regex |
Optional Keyword only Default None |
bool Choose whether a supplied pattern is interpreted as a regular expression. |
Returns
Series, Index, DataFrame or MultiIndex