0

Below is my dataframe:

date open high low close volume sma sr
0 2021-07-29 22.5 22.5 22.5 22.5 5 NaN 1

Now I want to print the value of sma on if it's not NaN.

Code:

if (df.loc[df['sr'] == 1]['sma'].values[0] != 'NaN') or (df.loc[df['sr'] == 1]['sma'].values[0] != "nan"):
    print(df.loc[df['sr'] == 1]['sma'].values[0])

There should be no output, but it is printing nan

selet
  • 31
  • 3

0 Answers0