Code Duplication    Length = 24-24 lines in 2 locations

src/egon/data/datasets/electrical_neighbours.py 2 locations

@@ 261-284 (lines=24) @@
258
                ignore_index=True,
259
            )
260
            next_bus_id += 1
261
        if 220.0 in vnom_per_country[cntr]:
262
            central_buses = pd.concat(
263
                [
264
                    central_buses,
265
                    pd.DataFrame(
266
                        index=[central_buses.index.max() + 1],
267
                        data={
268
                            "scn_name": scenario,
269
                            "bus_id": next_bus_id,
270
                            "x": central_buses[
271
                                central_buses.country == cntr
272
                            ].x.unique()[0],
273
                            "y": central_buses[
274
                                central_buses.country == cntr
275
                            ].y.unique()[0],
276
                            "country": cntr,
277
                            "carrier": "AC",
278
                            "v_nom": 220.0,
279
                        },
280
                    ),
281
                ],
282
                ignore_index=True,
283
            )
284
            next_bus_id += 1
285
286
    # Add geometry column
287
    central_buses = gpd.GeoDataFrame(
@@ 237-260 (lines=24) @@
234
    vnom_per_country = foreign_buses.groupby("country").v_nom.unique().copy()
235
    for cntr in vnom_per_country.index:
236
        print(cntr)
237
        if 110.0 in vnom_per_country[cntr]:
238
            central_buses = pd.concat(
239
                [
240
                    central_buses,
241
                    pd.DataFrame(
242
                        index=[central_buses.index.max() + 1],
243
                        data={
244
                            "scn_name": scenario,
245
                            "bus_id": next_bus_id,
246
                            "x": central_buses[
247
                                central_buses.country == cntr
248
                            ].x.unique()[0],
249
                            "y": central_buses[
250
                                central_buses.country == cntr
251
                            ].y.unique()[0],
252
                            "country": cntr,
253
                            "carrier": "AC",
254
                            "v_nom": 110.0,
255
                        },
256
                    ),
257
                ],
258
                ignore_index=True,
259
            )
260
            next_bus_id += 1
261
        if 220.0 in vnom_per_country[cntr]:
262
            central_buses = pd.concat(
263
                [