data = load('data.npy')
def split_classes(data,col):
newdata = []
nclasses = len(unique(data[:,col]))
classes = [[]] * nclasses
for row in data:
classes[int(row[col])].append(copy(row))
print(len(classes[0]),len(classes[1]),len(data))
return classes
split_classes(data,-1)
This just isn't doing what I want it to do. Values are being added to each list within the python array. The output in this case being: 200 200 200
Example:
Input:
[[4, 2, 0]
[3, 1, 0]
[5, 9, 1]]
Output:
[[4, 2, 0],[3, 1, 0]],[5, 9, 1]]