Reputation: 23
I have a dataframe:
I only want rows with values less than 6 for example.
I enter:
dists_df.all(axis=1) < 6
and I get True for every row.
I would think everything visible in the dataframe screenshot should return False.
Thank you.
Upvotes: 0
Views: 174
Reputation: 1432
You have your order of operations backwards. dists_df.all(axis=1)
returns True
for all rows first because each row exists completely. You then essentially run True < 6
which is true, as in this case True = 1
. You have to reverse the order.
(dists_df < 6).all(axis=1)
Upvotes: 1