第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”文件也出现同错误提示,请教如何修改此代码?

 
	
                                                 VIP会员
VIP会员 购物车
购物车

 私信
                         私信 
                     发表新帖
发表新帖 立即签到
立即签到 
        		  
        		 
         		 关注
关注
                  回复
 回复 支持(
                	支持( 反对(
                    反对(
 之前都有百度过的,原谅跨行学习的小白没看懂。
之前都有百度过的,原谅跨行学习的小白没看懂。 
                







 
                     
                     
					 
						 
						 
						 
						