I read a CSV File and everythings works except the conversion of the values to integers, since all the values there are strings. I tried to convert column-wise in a loop like this:
counter = 0
while counter < len(data):
try:
data[counter,0] = data[counter,0].astype(int) # ID
data[counter,1] = data[counter,1].astype(int) # Survived
except ValueError:
pass
counter = counter + 1
As you can see it is the titanic dataset I try to work with.
print (type(data[0,0]))
And printing the type of a value gives me <class 'numpy.str_'>
How do I properly convert the columns to integers? Thanks in advance!