Reputation: 1
I got a dataframe and I want to drop all the rows that contain a value >= 100 in all the columns (in the whole dataframe), not in just one specific column. I tried : df = df[(df < 100).any()] df.drop(df[(df <= 100)].index, inplace=True)
But nothing work... Could you please help ?
Upvotes: 0
Views: 1289
Reputation: 5802
Once you have the Boolean mask (df >= 100
or df.ge(100)
) you can select the rows where all values are True
with all(axis=1)
, then reverse the resulting mask with ~
to select the desired rows from the original df.
df = df[~df.ge(100).all(axis=1)]
Upvotes: 1