Site icon DataFlair

How to Apply Filter in Pandas DataFrame

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

Program 1

import pandas as pd
df=pd.read_excel("E://mypandas/employee.xlsx")
#print(df.loc[df['totalsalary']>10000])
#print(df.loc[~(df['gender']=='male') & (df['totalsalary']>10000)])
#print(df.loc[(df['empdept']=='CS') | (df['gender']=='male')])
#print(df.loc[df['empname'].str.contains('a')])

 

Exit mobile version