更新时间:2023-12-02 23:06:04
In [23]: df1
Out[23]:
Name income
0 a $1
1 b $2,000
2 c $10,000
3 d $140,000
In [24]: cols_to_change = ['income']
In [25]: for col in cols_to_change:
...: df1[col] = df1[col].str.replace('[$,]', '')
...:
In [26]: df1
Out[26]:
Name income
0 a 1
1 b 2000
2 c 10000
3 d 140000