答案 0 :(得分:2)
您可以使用:
data['Wage']=data['Wage'].replace("K","",regex=True)
或者:
data['Wage']=data['Wage'].astype(str).str.replace("K","")
答案 1 :(得分:0)
您还可以使用:
df = pd.DataFrame({'Wage': ['$200k', '$500']})
df['Wage'] = df['Wage'].str.split('k', expand=True)[0]
print(df)
输出:
Wage
0 $200
1 $500
OR
df['Wage'] = df['Wage'].str.replace(r'k', '')
print(df)
输出:
Wage
0 $200
1 $500