I am trying to split the values in the location column to two different x and y columns in a csv file
Right now it looks like this:
location
[60.0, 56.0]
[68.0, 74.0]
[58.0, 52.0]
[63.0, 53.0]
[119.0, 79.0]
I want it to split the columns and get two different columns and remove the brackets so the columns look like this:
x y
60 56
68 74
58 52
63 53
119 79
I all of these: 1.
df[['x', 'y']] = pd.DataFrame(df['location'].tolist(), index=df.index)
pd.concat([df[[0]], df['location'].str.split(',', expand=True)], axis=1
df['location'].str.split(',', expand=True)
But recieved errors
CodePudding user response: