I am wondering why no one mentions the builtin functions pandas dataframe has is similar to isin method. Here is a quick example
df = pd.DataFrame({'cost': [250, 150, 100], 'revenue': [100, 250, 300]},index=['A', 'B', 'C']) cost revenue A 250 100 B 150 250 C 100 300 Compare DataFrames for equality elementwise
df=df[df["cost"].eq(250)] Compare DataFrames for greater than inequality or equality elementwise.
df=df[df["cost"].ge(100)] Compare DataFrames for strictly less than inequality elementwise.
df =df[df["cost"].lt(200)] 

