0

I am trying to run a specific line of script based on a cell value in an excel data frame. I basically want to conduct the calculation if a specific cell is not empty. For this, I used the code below:

check=df.iat[1,13]  #I am reading the value of the cell

if check is not (None, "[nan]"):
    print("cell is not empty")

when I print the value of check (the cell value), I get 'nan'. However, the if statement is not working as nothing is printed.

I am not sure why is this happening and I will appreciate any hints. Thanks!

Kimchi
  • 97
  • 6

1 Answers1

0

Answer provided by Vinzent

check=df.iat[1,13]  #I am reading the value of the cell
if not pd.isna(check):
    print("cell is not empty")

Kimchi
  • 97
  • 6