I have a dataframe. One of the columns is a combination of CITY
and STATE
. I want to split this column to two columns, CITY
and STATE
using:
df['CITY'],df['STATE'] = df['WORKSITE'].str.split(",")
And I got this error:
ValueError Traceback (most recent call last) in () ----> 1 df['CITY'],df['STATE'] = df['WORKSITE'].str.split(",")
ValueError: too many values to unpack (expected 2)
So, I'm wondering is there a method that I can ignore the exceptions or detect which row is not working?