You can probably set the index of df2
to be the same as df1
df1 = pd.DataFrame(columns=list('ABC'))
df1.loc[0] = [1,2,3]
df2 = pd.DataFrame(columns=list('DE'))
df2.loc[0] = [18,3]
This will keep the index of df1
df2.index = df1.index
temp = pd.concat([df1, df2], axis=1)
if you don't care about the index at all you can reset and drop the index
temp = pd.concat([df1.reset_index(drop=True), df2.reset_index(drop=True)], axis=1)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…