I tried to check if a variable is equal to np.nan in the code(4th last line). But somehow I don't get a desired output while doing this rather when I use np.nan with check condition it sort of ignores the statement itself, the code seems to run well for other values.
My code:
import pandas as pd
import numpy as np
d={}
f=0
data=pd.read_excel('Book1.xlsx')
for i in data[:]:
d[i]=0
f=0
for j in data[i]:
print(j)
if j==np.nan:
f=f+1
d[i]=f
print(d)
Please tell if I'm doing something wrong, and how to resolve this?