In case someone else wants to split a single column (deliminated by a value) into multiple columns – try this:
series.str.split(',', expand=True)
This answered the question I came here looking for.
Credit to EdChum’s code that includes adding the split columns back to the dataframe.
pd.concat([df[[0]], df[1].str.split(', ', expand=True)], axis=1)
Note: The first argument df[[0]]
is DataFrame
.
The second argument df[1].str.split
is the series that you want to split.
split Documentation
concat Documentation