Search
 
SCRIPT & CODE EXAMPLE
 

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')
Comment

PREVIOUS NEXT
Code Example
Python :: numpy how to calculate variance 
Python :: pandas query on datetime 
Python :: median absolute deviation python 
Python :: TabError: inconsistent use of tabs and spaces in indentation 
Python :: plt axis label font size 
Python :: sort defaultdict by value 
Python :: how to get seconds from datetime in python 
Python :: how to upload file in python tkinter 
Python :: 2 numbers after comma python 
Python :: except as exception: 
Python :: how to make random colors in python turtle 
Python :: pip install specific version 
Python :: Creating virtual environments 
Python :: python get system information 
Python :: accessing dictionary elements in python 
Python :: discord.py get profile picture 
Python :: display Surface quit 
Python :: python fernet 
Python :: how to open sound file in python 
Python :: send email with flask 
Python :: cyclically rotate an array by one 
Python :: turtle write 
Python :: python3 hello world 
Python :: sns palette 
Python :: how to check if python is 32 or 64 bit 
Python :: create a df in pandas 
Python :: mad libs in python 
Python :: from imblearn.over_sampling import smote error 
Python :: convert pandas column type 
Python :: display youtube video in jupyter notebook 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =