I have multiple datasets which has same columns name as below example, I want the columns which are repeated in multiple datasets sort out in list format using python and pandas.
df1 = pd.DataFrame({'A': 'foo bar foo bar foo bar foo foo'.split(),
'B': 'one one two three two two one three'.split(),
'C': np.arange(8),
'D': np.arange(8) * 2})
df2 = pd.DataFrame({'A': 'foo bar foo bar foo bar foo foo'.split(),
'B': 'one one two three two two one three'.split(),
'C': np.arange(8)})
df3 = pd.DataFrame({'A': 'foo bar foo bar foo bar foo foo'.split(),
'B': 'one one two three two two one three'.split(),
'D': np.arange(8) * 2})
As from above we can see in three Datasets df1, df2, df3 has repeated columns as 'A', 'B' and the output as ['A', 'B'] Please can give solution to this problem. Thanks in Advance