我注意到pandas replace函数中有一个strance bahavior,它试图用字典传递字典,如下所示:
mutual_format = {'col1' : {'(?i)o':'0', '[^\d)]':''},
'col2' : {'name ':''}}
df.replace(mutual_format, regex=True)
在这种情况下,列2替换工作,但第一个被完全忽略。 我做错什么了?你知道吗
col1 | col2
0004564321 / O name asdfg asd as
00045632145 / O name bla bla
00045632145 name asdf asdf
目前没有回答
相关问题 更多 >
编程相关推荐