I am wondering why no one mentions the builtin functionsHere are options using pandas dataframe has isbuilt-in functions, 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"]df[df["cost"].eq(250)] cost revenue A 250 100 Compare DataFrames for greater than inequality or equality elementwise.
df=df[df["cost"]df[df["cost"].ge(100)] cost revenue A 250 100 B 150 250 C 100 300 Compare DataFrames for strictly less than inequality elementwise.
df =df[df["cost"]df[df["cost"].lt(200)] cost revenue B 150 250 C 100 300 

