I have the following code. Before I added the outer if/else condition, I was getting an error: "'<' not supported between instances of 'NoneType' and 'float'" as the database was returning NoneType occasionally which was being compared to 98.5. To prevent this, I put the outer if condition so that the inner if condition never performs the calculation if the type is NoneType. However, the error still persists. Does anyone know why? Checking in the shell and the error is there too. Is there some way other way of doing this type comparison.
count = 0
get_data = [data for data in cur]
for i in range(len(get_data)):
if type(get_data[i][2]) != "NoneType":
if get_data[i][2] < 98.5:
vsd_stat.append(1)
else:
vsd_stat.append(0)
else:
count += 1
df = pd.DataFrame(vsd_stat)```