I would like to combine multiple DataFrames with some coincident columns, into a new DataFrame. The columns of the new DataFrame should be the coincident columns.
For example, suppose I have dataframes df1, df2, df3:
df1:
A B C D
1 2 3 4
df2:
A C D E
1 2 -1 5
df3:
C D F G
0 -1 0 7
New dataframe
C D
3 4
2 -1
0 -1
I have tried using match function in a circular way, to find the coincident columns:
match(df1,df2)
match(df2,df3)
match(df3,df1)
It takes a lot of time and lines, if I have many DataFrames. Could anyone suggest a better way to do that?