pypsa.clustering.ClusteringAccessor.busmap_by_kmeans#
- ClusteringAccessor.busmap_by_kmeans(bus_weightings: pd.Series, n_clusters: int, buses_i: pd.Index | None = None, **kwargs: Any) pd.Series #
Create a bus map from the clustering of buses in space with a weighting.
- Parameters:
n (pypsa.Network) – The buses must have coordinates x, y.
bus_weightings (pandas.Series) – Series of integer weights for buses, indexed by bus names.
n_clusters (int) – Final number of clusters desired.
buses_i (None|pandas.Index) – If not None (default), subset of buses to cluster.
kwargs – Any remaining arguments to be passed to KMeans (e.g. n_init, n_jobs).
- Returns:
busmap – Mapping of n.buses to k-means clusters (indexed by non-negative integers).
- Return type:
pandas.Series