Cluster Analysis in Python
Shaumik Daityari
Business Analyst
timeit
module.linkage()
methodfrom scipy.cluster.hierarchy import linkage import pandas as pd import random, timeit
points = 100 df = pd.DataFrame({'x': random.sample(range(0, points), points), 'y': random.sample(range(0, points), points)})
%timeit linkage(df[['x', 'y']], method = 'ward', metric = 'euclidean')
1.02 ms ± 133 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
Cluster Analysis in Python