import pandas as pd
import numpy as np
# 随机生成两个df
df1 = pd.DataFrame(np.random.randn(3,4),columns = ['A','B','C','D'])
df2 = pd.DataFrame(np.random.randn(2,3),columns = ['A','B','D'])
print('打印df1\n',df1)
print('打印df2\n',df2)
# 默认纵向合并
qh_df_z = pd.concat([df1,df2])
print("默认纵向合并qh_df_z\n",qh_df_z)
# 默认横向全连接
qh_df_h= pd.concat([df1,df2],axis=1,join='outer')
print("默认纵向合并qh_df_h\n",qh_df_h)
# 默认横向相同交叉索引部分连接,不交叉部分不显示
qh_df_h1= pd.concat([df1,df2],axis=1,join='inner')
print("默认横向相同交叉索引部分连接,不交叉部分不显示qh_df_h1\n",qh_df_h1)
qh_df_a = df1.append(df2)
print(qh_df_a)