FafamKurac123
FafamKurac123

Reputation: 49

Checking for values in the dataframe

I have dataframes in the form of:

            price       percentage
Date        
2021-10-11  298.075989  NaN
2021-10-18  308.570007  0.035206
2021-10-25  308.130005  -0.001426

I would like to check whether all the percentages (except NaN) are above 2 percent and then I would like to print a certain statement. How do I do that? Thanks in advance

Upvotes: 0

Views: 35

Answers (1)

mnist
mnist

Reputation: 6956

Your example seems a bit off, but does this satisfy your needs?

if all(df.percentage.dropna() > 2):
    print('All are above 2 percent!')

Upvotes: 1

Related Questions