Remove opening and closing parenthesis with word in pandas

前端 未结 4 863
庸人自扰
庸人自扰 2021-01-26 01:07

Given a data frame:

df = 

                         multi
0 MULTIPOLYGON(((3 11, 2 33)))
1 MULTIPOLYGON(((4 22, 5 66)))

I was trying to remov

4条回答
  •  终归单人心
    2021-01-26 01:33

    You can also use str.replace with a regex:

    # removes anything that's not a digit or a space or a dot
    df['multi'] = df.multi.str.replace('[^0-9\. ]', '', regex=True)#changing regex
    

提交回复
热议问题