How to Use isin() and not isin() Method in Pandas DataFrame

Free Pandas course with real-time projects Start Now!!

Program 1

import pandas as pd
emp=pd.read_excel("E:\mypandas\employee.xlsx")
#select * from emp where salary in(5000,6000,8000);
#print(emp[emp.salary.isin([6000,7000])])
#print(emp[emp.salary.isin([6000,7000,10000])])
#print(emp[emp.age.isin([30,21,50])])
#select * from employee where salary not in(5000,6000,8000);

#print(emp[~emp.salary.isin([6000,7000,10000])])
print(emp[(~emp.age.isin([30,21,40,25,45])) & (emp.salary>10000)])

 

Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *