Python 在不知道列数的情况下组合数据帧

Python 在不知道列数的情况下组合数据帧,python,dataframe,Python,Dataframe,我有Dataframe1,它是: A B apple tree bed house triangle cheese 和数据帧2: C D dog rabbit cat cheese fish gold 有没有一种方法可以像下面这样将它们连接在一起,而不知道Dataframe 2中的列是什么,或者有多少列 A B C D apple tree

我有Dataframe1,它是:

A          B
apple      tree
bed        house
triangle   cheese
和数据帧2:

C      D
dog    rabbit
cat    cheese
fish   gold
有没有一种方法可以像下面这样将它们连接在一起,而不知道Dataframe 2中的列是什么,或者有多少列

A          B         C       D       
apple      tree      dog     rabbit
bed        house     cat     cheese
triangle   cheese    fish    gold

如果它们的行数相同,则可以执行以下操作

df=pd.concat[df1,df2],轴=1


你做过研究吗?这能回答你的问题吗?
A          B         C       D       
apple      tree      dog     rabbit
bed        house     cat     cheese
triangle   cheese    fish    gold