.copy() shortcut
This commit is contained in:
parent
8cb4c17930
commit
7f29c31abe
@ -269,10 +269,7 @@ def busmap_for_n_clusters(n, n_clusters, solver_name, focus_weights=None, algori
|
|||||||
|
|
||||||
# overwrite country of nodes that are disconnected from their country-topology
|
# overwrite country of nodes that are disconnected from their country-topology
|
||||||
for country in n.buses.country.unique():
|
for country in n.buses.country.unique():
|
||||||
m = n.copy()
|
m = n[n.buses.country ==country].copy()
|
||||||
m.buses = m.buses.query("country in @country")
|
|
||||||
m.lines = m.lines.query("bus0 in @m.buses.index and bus1 in @m.buses.index")
|
|
||||||
m.links = m.links.query("bus0 in @m.buses.index and bus1 in @m.buses.index")
|
|
||||||
|
|
||||||
_, labels = csgraph.connected_components(m.adjacency_matrix(), directed=False)
|
_, labels = csgraph.connected_components(m.adjacency_matrix(), directed=False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user