Let’s see how to split a text column into two columns in Pandas DataFrame.
Method #1 : Using
Split Name column into two different columns. By default splitting is done on the basis of single space by
Split Name column into “First” and “Last” column respectively and add it to the existing Dataframe .
Use underscore as delimiter to split the column into two columns.
tolist() function together.
Method #2 : Using
Split Name column into two different columns.
Split Name column into two different columns named as “First” and “Last” respectively and then add it to the existing Dataframe.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python | Pandas Split strings into two List/Columns using str.split()
- Join two text columns into a single column in Pandas
- Split a String into columns using regex in pandas DataFrame
- Convert given Pandas series into a dataframe with its index as another column on the dataframe
- Create a new column in Pandas DataFrame based on the existing columns
- Select all columns, except one given column in a Pandas DataFrame
- Python | Pandas Reverse split strings into two List/Columns using str.rsplit()
- Get column index from column name of a given Pandas DataFrame
- Create a Pandas DataFrame from a Numpy array and specify the index column and column headers
- Split a column in Pandas dataframe and get part of it
- Split Pandas Dataframe by column value
- Split Pandas Dataframe by Column Index
- How to Convert Dataframe column into an index in Python-Pandas?
- Split large Pandas Dataframe into list of smaller Dataframes
- Difference of two columns in Pandas dataframe
- Concatenate two columns of Pandas dataframe
- Sort the Pandas DataFrame by two or more columns
- How to fixed one column and scrollable other column or columns in Bootstrap ?
- Tableau - Split the text to columns
- Create a DataFrame from a Numpy array and specify the index column and column headers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.