1、说明
join方法为将两个DataFrame中的不同列索合并成一个DataFrame提供了一个简单的方法。
2、语法
join(self,other,on=None,how='left',lsuffix='',rsuffix='',sort=False):
3、返回值
DataFrame包含来自调用方和调用方的DataFrame other。
4、注意
参数on, DataFrame对象不支持lsuffix和rsuffix传输列表。
将索引级别指定为on参数的支持已在0.23.0版中添加。
5、实例
>>>df.join(other,lsuffix='_caller',rsuffix='_other') key_callerAkey_otherB 0K0A0K0B0 1K1A1K1B1 2K2A2K2B2 NaNaN33K3AN3 NaNNa44K44K4 NaNaN55K55
以上是python join()合并DataFrame的操作,希望对大家有所帮助。更多Python学习指导:python基础教程