1、错误原因。
使用merge()函数时,2个表中出现了重复列,原因是pandas2.0.0删除了以前版本可以默认将重复列转换成"状态_x","状态_y"的形式。(版本更换不兼容是真的坑啊!)
“
-
Enforced disallowing merge() to produce duplicated columns through the
suffixes
keyword and already existing columns (GH 22818)
”
2、修改方法,在merge函数中加入参数suffixes
pd.merge(df1,df2,how=left,left_index=True,right_index=True,suffixes=('_old','_new')