Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

split strings around given separator/delimiter

# split strings around given separator/delimiter
# import Pandas as pd 
import pandas as pd 
   
# create a new data frame 
df = pd.DataFrame({'Location': ['Cupertino,California', 'Los Angles, California', 'Palo Alto, California']
                   }) 
   
df[['City','State']] = df.Location.str.split(',',expand=True) 
df
print(df)
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #split #strings
ADD COMMENT
Topic
Name
7+3 =