Python 如何在一个命令中转换多个列?

Python 如何在一个命令中转换多个列?,python,string,pandas,str-replace,Python,String,Pandas,Str Replace,与一次转换一列不同,如下图所示,如何在一个命令中同时转换这两个列 df['Name'] = df['Name'].str.decode('utf-8').str.replace('.', '-') df['Town'] = df['Town'].str.decode('utf-8').str.replace('.', '-') df[['Name','Town']]=df[['Name','Town']].apply(lambda x:x.str.decode()…)?非常感谢

与一次转换一列不同,如下图所示,如何在一个命令中同时转换这两个列

df['Name'] = df['Name'].str.decode('utf-8').str.replace('.', '-')
df['Town'] = df['Town'].str.decode('utf-8').str.replace('.', '-')

df[['Name','Town']]=df[['Name','Town']].apply(lambda x:x.str.decode()…)
?非常感谢