# Agglomerative Clustering find observations nearest to “center” of cluster

I'm using AgglomerativeClustering to group time-series with Dynamic Time Warping (DTW) as a metric. I get distance matrix and pass it to clustering.

#dtwMetric is the callable that accepts two observations
dist_m = sklearn.metrics.pairwise.pairwise_distances(data_frame, metric=dtwMetric)

agg = AgglomerativeClustering(n_clusters=10, affinity='precomputed',

labels = agg.fit_predict(dist_m)


Then I can get a cluster label for each observation (time-series) in my data frame.

I need to get SARIMAX forecasting later for each cluster using only one (the "most centered") time-series from cluster, so I suppose I don't want an "average" series per cluster but one of my initial observations.

How do I select the "most centered" time-series for each cluster?