Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 226-249 (lines=24) @@
223
            )
224
            next_bus_id += 1
225
226
        if 220.0 in vnom_per_country[cntr]:
227
            central_buses = pd.concat(
228
                [
229
                    central_buses,
230
                    pd.DataFrame(
231
                        index=[next_bus_id],
232
                        data={
233
                            "scn_name": scenario,
234
                            "bus_id": next_bus_id,
235
                            "x": central_buses[
236
                                central_buses.country == cntr
237
                            ].x.unique()[0],
238
                            "y": central_buses[
239
                                central_buses.country == cntr
240
                            ].y.unique()[0],
241
                            "country": cntr,
242
                            "carrier": "AC",
243
                            "v_nom": 220.0,
244
                        },
245
                    ),
246
                ],
247
                ignore_index=True,
248
            )
249
            next_bus_id += 1
250
251
    # Add geometry column
252
    central_buses = gpd.GeoDataFrame(
@@ 201-224 (lines=24) @@
198
    vnom_per_country = foreign_buses.groupby("country").v_nom.unique().copy()
199
    for cntr in vnom_per_country.index:
200
        print(cntr)
201
        if 110.0 in vnom_per_country[cntr]:
202
            central_buses = pd.concat(
203
                [
204
                    central_buses,
205
                    pd.DataFrame(
206
                        index=[next_bus_id],
207
                        data={
208
                            "scn_name": scenario,
209
                            "bus_id": next_bus_id,
210
                            "x": central_buses[
211
                                central_buses.country == cntr
212
                            ].x.unique()[0],
213
                            "y": central_buses[
214
                                central_buses.country == cntr
215
                            ].y.unique()[0],
216
                            "country": cntr,
217
                            "carrier": "AC",
218
                            "v_nom": 110.0,
219
                        },
220
                    ),
221
                ],
222
                ignore_index=True,
223
            )
224
            next_bus_id += 1
225
226
        if 220.0 in vnom_per_country[cntr]:
227
            central_buses = pd.concat(