TypeError: argument of type 'float' is not iterable
As you can see, when you inspect the test.data
, you will obviously see that the first line of data has "NAN" in income_bracket
field.
I have further inspected that this is the only line contains "NAN" by doing:
ib = df_test ["income_bracket"]
t = type('12')
for idx,i in enumerate(ib):
if(type(i) != t):
print idx,type(i)
RESULT: 0 <type 'float'>
So you may just skip this row by:
df_test = pd.read_csv(file_test , names=COLUMNS, skipinitialspace=True, skiprows=1)