concat
concat :join another DataFrame
重要参数:
axis = 1 横向合并
axis = 0(default) 纵向合并
ignore_index: default False: 此时的index只是两个DataFrame的组合,并没有重新排序
True: index重新排序
# axis =1 各表在横向拼接
result_up = pd.concat([text_left_up, text_right_up], axis = 1)
result_down = pd.concat([text_left_down, text_right_down], axis = 1)
# 默认axis=0, 纵向拼接
result = pd.concat([result_up, result_down],ignore_index = 'True')
join
用于横向拼接
lsuffix=’_caller’: 若出现重复的列索引,在原有数组的列索引上加上后缀’_caller’
rsuffix=’_other’ 若出现重复的列索引,在加上的数组列索引上添加后缀’_other’
#join将都多个pandas对象横向拼接
text_up = text_left_up.join(text_right_up)
text_down = text_left_down.join(text_right_down)
merge
用于横向拼接
必须要设置合并索引:left_index;right_index默认值为False, 都设置为正时意味着两个列表以各自index为基准进行合并