python dataframe split column by delimiter code example

Example 1: pandas split by space

# importing pandas module  
import pandas as pd 

# new data frame with split value columns 
data["Team"]= data["Team"].str.split(" ", n = 1, expand = True) 

# df display 
data

Example 2: dataframe split column

df[['First','Last']] = df.Name.str.split(" ", expand=True)

Example 3: how to use split in pandas

import pandas as pd 

# new data frame with split value columns 
data["Team"]= data["Team"].str.split(" ", n = 1, expand = True) 

# df display 
data