python 把几个DataFrame合并成一个DataFrame——merge,append,join,concat
pandas provides various facilities for easily combining together Series, DataFrame, and Panel objects with various kinds of set logic for the indexes and relational algebra functionality in the case of join / merge-type operations.
1、merge
pd.merge(left, right, how='inner', on=None, left_on=None, right_on=None, left_index=False, right_index=False, sort=True, suffixes=('_x', '_y'), copy=True, indicator=False)
left︰ 对象
right︰ 另一个对象
on︰ 要加入的列 (名称)。必须在左、 右综合对象中找到。如果不能通过 left_index 和 right_index 是假,将推断 DataFrames 中的列的交叉点为连接键
left_on︰ 从左边的综合使用作为键列。可以是列名或数组的长度等于长度综合
right_on︰ 从正确的综合,以用作键列。可以是列名或数组的长度等于长度综合
left_index︰ 如果为 True,则使用索引 (行标签) 从左综合作为其联接键。在与多重 (层次) 的综合,级别数必须匹配联接键从右综合的数目
right_index︰ 相同用法作为正确综合