I am trying to split a column containing City, State, and Zip into three columns. The data in the column is in this format: 'City, State Zip' - comma separating the city from state, and a space separating state from zip code. I can split out the city using:
df['Owner City State Zip'].str.split(',').apply(lambda x: x[0]
But for some reason when I try the following to split out the state and zip:
df['Owner City State Zip'].str.split(',').apply(lambda x: x[1]
I get the error - Index is out of range
Any help would be appreciated! This seems trivial but has been more difficult than I was expecting.