Open In App

Split a text column into two columns in Pandas DataFrame

Last Updated : 26 Dec, 2018
Comments
Improve
Suggest changes
2 Likes
Like
Report
Let's see how to split a text column into two columns in Pandas DataFrame. Method #1 : Using Series.str.split() functions. Split Name column into two different columns. By default splitting is done on the basis of single space by str.split() function.
Output :   Split Name column into "First" and "Last" column respectively and add it to the existing Dataframe .
Output:   Use underscore as delimiter to split the column into two columns.
Output :   Use str.split(), tolist() function together.
Output :   Method #2 : Using apply() function. Split Name column into two different columns.
Output : Split Name column into two different columns named as "First" and "Last" respectively and then add it to the existing Dataframe.
Output :

Next Article

Similar Reads