第4章P118页中“对合并数据去重”(示例38),使用pandas的merge方法“df_merge=pd.merge(df1,df2,on='编号',left_index=True,right_index=True)”,编写完成后显示如下错误:
Traceback (most recent call last):
File "C:/Python(示例37).py", line 16, in <module>
df_merge = pd.merge(df1,df2,on='编号',right_index=True)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\reshape\merge.py", line 87, in merge
validate=validate,
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\reshape\merge.py", line 650, in __init__
self._validate_specification()
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\reshape\merge.py", line 1304, in _validate_specification
'Can only pass argument "on" OR "left_index" '
pandas.errors.MergeError: Can only pass argument "on" OR "left_index" and "right_index", not a combination of both.
教材所含资料包中的“demo”文件也出现同错误提示,请教如何修改此代码?