【发布时间】:2022-08-02 18:05:12
【问题描述】:
我有以下df:
import pandas as pd
df = pd.DataFrame({\"name\" : [\"a\", \"b\", \"c\"], \"value\" : [\'1\\xa0412\', 4, 2]})
我想用 1 替换 \'1\\xa0412\'。我试试这个:
df[\'value\'] = df[\'value\'].str.replace(r\'\\\\.*\', \'\', regex=True)
但它不起作用。请问我该如何解决?