Question

my code is : km = KMeans(n_clusters=2, init='k-means++', max_iter=100, n_init=1,verbose=0) predict=[]
predict.append(km.fit_predict(matrix))
the result is :[array([0,0,1,1,0])]

then I want to zip this result by list of string the result of zip is a list with one member because it assume*[array([0,0,1,1,0])]* as a list that has one member.

what should I do?

Was it helpful?

Solution

The function is returning a list with one array in it. So, you should be able to zip it with:

zip(list_of_strings, result[0])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top