I got the result and then try to retrieve the values I got None values
I have defined a function who_score('d','g','sm',a,ch,sb)
and then I want to use that function to make a new list based on if conditions. So, I made a loop to iterate over my data df_6_factors
and append the result for each row in a new list called who_estimator
here is my code:
who_esimator = [] #the empty list
for i in range(10):
if df_6_factors.isnull().iat[i,0] or df_6_factors.isnull().iat[i,1] or df_6_factors.isnull().iat[i,2] or df_6_factors.isnull().iat[i,3] or df_6_factors.isnull().iat[i,4] or df_6_factors.isnull().iat[i,5]:
who_esimator.append('NaN')
else:
if df_6_factors.iat[i,1] == 0:
d = 'n'
elif df_6_factors.iat[i,1] == 1:
d = 'y'
else:
d = 'e'
if df_6_factors.iat[i,2] == 0:
g = 'm'
elif df_6_factors.iat[i,2] == 1:
g = 'f'
else:
g = 'e'
a = df_6_factors.iat[i,3]
if df_6_factors.iat[i,4] <=2:
sm = 'n'
else:
sm = 'y'
ch = df_6_factors.iat[i,5]
sb = df_6_factors.iat[i,6]
who_esimator.append(who_score(d,g,sm,a,ch,sb))
I got the output that I want as you see here:
15
2
6
4
7
40
20
6
but when I want to read the list who_esimator
I got none value and 'NaN' value even though the data is not Null
[None, 'NaN', None, None, None, None, 'NaN', None, None, None]
I am a python self_learner and appreciate any help
Thanks