Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calNewCentroids(clusters):
- newcentroids = []
- for k in clusters:
- sumc = 0
- for l in range(len(clusters[k])):
- sumc += df.loc[clusters[k][l]]
- cent = sumc/len(clusters[k])
- newcentroids.append(tuple(cent))
- return newcentroids
Add Comment
Please, Sign In to add comment