Site icon DataFlair

How to Apply Filter in Pandas DataFrame

Get Job-Ready: Data Analysis using Python with 70+ 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