from sklearn.cluster import AgglomerativeClustering
cluster = AgglomerativeClustering(n_clusters=16, affinity='euclidean', linkage='ward')
cluster.fit_predict(small)
import matplotlib.pyplot as plt
%matplotlib inline
plt.figure(figsize=(10, 7))
plt.scatter(small['tracks'], small['genre_top'], c=cluster.labels_, cmap='rainbow')
我得到这样的数组: