Code Duplication    Length = 24-24 lines in 2 locations

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

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