I want to read the csv file information so that the algorithm has the ability to guess the gender of individuals. The program guesses people through height, weight, and gender footwear numbers.
But I'm faced with this error and I can not fix it:
IndexError: list index out of range
height,weight,n_shoes,sexuality 190,88,44,male 167,66,36,female 182,80,42,male 177,78,43,male 164,59,35,female 183,79,40,male 158,57,36,female 155,52,34,female 193,89,45,male 163,54,35,female
import csv from sklearn import tree x =  y =  with open('people.csv' , 'r') as csvfile: data = csv.reader(csvfile) for line in data: x.append(line[1:4]) y.append(line) clf = tree.DecisionTreeClassifier() clf = clf.fit(x , y) new_data = [[190,89,43] , [160,56,39]] answer = clf.predict(new_data) print(answer) print(answer)
I want to read the csv file information so that the algorithm has the ability to guess the gender of individuals.
Read the new data from the
new_data variable and guess the personality of the person.
[190 , 89 , 42] ==> male [162 , 59 , 37] ==> female