I am attempting a bit of knn classification. when i try to normalize the data in an array i keep getting the above error.
norm_val = 100.00
for i in range(0, len(ListData)):
ListData[i][0] = int(ListData[i][0]/max_val)
I'm getting the error on the last line which says, 'int' object is not subscriptable.
Thanks
ListDataa list of lists or just a simple list? If it is a simple list,ListData[i][0]is incorrect.ListDatalook like? Your code is assumingListDatacontains sequences of integers, but your error message suggests it may contain just integers.len(ListData)is called. So this code is perfectly enough to diagnose the problem. All the data is there.