Python——把几个DataFrame合并成一个DataFrame
横向合并——merge
1 | result = pd.merge(left, right, on='key') |
1 | result = pd.merge(left, right, on=['key1', 'key2']) |
横向合并——join
1 | result = left.join(right, on=key_or_keys) #共同指标的关键词 |
竖向合并——append
1 | result = df1.append(df2) |
竖向合并——concat
1 | frames = [df1, df2, df3] |