Code Duplication    Length = 24-24 lines in 2 locations

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

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