我确实有一个像这样的DataFrame:
col1 col 2
abc sure
def yes
ghi no
jkl no
mno sure
pqr yes
stu sure
我的意图是将“ sure”和“ yes”重命名为“ confirm”,以使DataFrame看起来像:
col1 col 2
abc confirm
def confirm
ghi no
jkl no
mno confirm
pqr confirm
stu confirm
这该怎么做 :)?
您可以:
df = df.replace(['yes','sure'],'confirm')
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句