Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

identify the common columns between two dataframes pandas python

a = np.intersect1d(df2.columns, df1.columns)
print (a)
['B' 'C']

a = df2.columns.intersection(df1.columns)
print (a)
Index(['B', 'C'], dtype='object')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #identify #common #columns #dataframes #pandas #python
ADD COMMENT
Topic
Name
1+5 =