一、concat:沿轴合并
concat(objs, axis=0, join='outer', join_axes=None, ignore_index=False, keys=None, levels=None, names=None, verify_integrity=False, sort=None, copy=True)
参数介绍:
objs:需要连接的对象集合,一般是列表或字典;
axis:连接轴向(默认axis=0);
join:参数为‘outer’或‘inner’;
join_axes=[]:指定自定义的索引;
keys=[]:创建层次化索引;
ignore_index=True:重建索引
举例:
>>> s1 = pd.Series(['a', 'b'])
>>> s2 = pd.Series(['c', 'd'])
>>> pd.concat([s1, s2])
0 a
1 b
0 c
1 d
# 参数 ignore_index
>>> pd.concat([s1, s2], ignore_index=True)
0 a
1 b
2 c
3 d
# 参数 keys
>>> pd.concat([s1, s2], keys=['s1', 's2',])
s1 0 a