I have two lists both of them of the same size I have 28 sets, and I need to count how many elements per set there are, these sets may also be empty, since they are the fruit of a clustering analysis. I was thinking to have a list of lists called cluster_entries such as cluster_entries = [[0]*28], and then appending the corresponding value found ad idx_n[i] to the corresponding cluster_entries[idx_n[i]]
so for instance if I have idx_n[20] = 10 I would like to add to the list 20 of cluster_entries the value 20. Thus I wrote the following code:
for i in range(len(idx_n)):
print i, idx_n[i]
cluster_entries[int(idx_n[i])].append(list_from_files[i])
Unfortunately this code appends always to the first element... and I do not understand why