Skip to content

Commit

Permalink
fix pandas deprecation error in select_subnet()
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenMeinecke committed Jul 23, 2021
1 parent ea42240 commit dc87def
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pandapower/toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1531,15 +1531,15 @@ def select_subnet(net, buses, include_switch_buses=False, include_results=False,
net[table[4:]].shape[0]:
continue
elif table == "res_bus":
p2[table] = net[table].loc[buses]
p2[table] = net[table].loc[buses.intersection(net[table].index)]
else:
p2[table] = net[table].loc[p2[table[4:]].index]
p2[table] = net[table].loc[p2[table[4:]].index.intersection(net[table].index)]
if "bus_geodata" in net:
p2["bus_geodata"] = net.bus_geodata.loc[p2.bus.index[p2.bus.index.isin(
net.bus_geodata.index)]]
p2["bus_geodata"] = net.bus_geodata.loc[p2.bus.index.intersection(
net.bus_geodata.index)]
if "line_geodata" in net:
p2["line_geodata"] = net.line_geodata.loc[p2.line.index[p2.line.index.isin(
net.line_geodata.index)]]
p2["line_geodata"] = net.line_geodata.loc[p2.line.index.intersection(
net.line_geodata.index)]

# switches
p2["switch"] = net.switch.loc[
Expand Down Expand Up @@ -2937,7 +2937,10 @@ def merge_same_bus_generation_plants(net, gen_elms=["ext_grid", "gen", "sgen"],
"""
if add_info:
for elm in gen_elms:
net[elm]["includes_other_plants"] = False
# adding column 'includes_other_plants' if missing or overwriting if its no bool column
if "includes_other_plants" not in net[elm].columns or net[elm][
"includes_other_plants"].dtype != bool:
net[elm]["includes_other_plants"] = False

# --- construct gen_df with all relevant plants data
cols = pd.Index(["bus", "vm_pu", "p_mw", "q_mvar"])
Expand Down

0 comments on commit dc87def

Please sign in to comment.