I have a CSV dataset that looks like this:
FirstAge,SecondAge,FirstCountry,SecondCountry,Income,NAME
41,41,USA,UK,113764,John
53,43,USA,USA,145963,Fred
47,37,USA,UK,42857,Dan
47,44,UK,USA,95352,Mark
I'm trying to load it into Python 3.6 with this code:
>>> from numpy import genfromtxt
>>> my_data = genfromtxt('first.csv', delimiter=',')
>>> print(train_data)
Output:
[[ nan nan nan nan
nan nan]
[ 4.10000000e+01 4.10000000e+01 nan nan
1.13764000e+05 nan]
[ 5.30000000e+01 4.30000000e+01 nan nan
1.45963000e+05 nan]
...,
[ 2.10000000e+01 3.00000000e+01 nan nan
1.19929000e+05 nan]
[ 6.90000000e+01 6.40000000e+01 nan nan
1.52667000e+05 nan]
[ 2.00000000e+01 1.90000000e+01 nan nan
1.05077000e+05 nan]]
I've looked at the Numpy docs and I don't see anything about this.
USAorUKa number ?! What's the problem you're facing?nanstand in for strings that can't be interpreted as floats.