e2nIEE / pandapower

Convenient Power System Modelling and Analysis based on PYPOWER and pandas
https://www.pandapower.org
Other
807 stars 470 forks source link

[bug] select_subnet loses dataframes #2333

Open KS-HTK opened 5 days ago

KS-HTK commented 5 days ago

Bug report checklis

Reproducible Example

import pandapower as pp
from pandapower.toolbox import select_subnet
import pandas as pd

net1 = pp.create_empty_network()
b1 = pp.create_bus(net1, vn_kv=110)
b2 = pp.create_bus(net1, vn_kv=220)

net1["example"] = pd.DataFrame([(1, 2, 3)], columns=["a", "b", "c"])

print(net1)

print(select_subnet(net1, [b1]))

Issue Description and Traceback

Any unknown DataFrame is droped by select_subnet. This is not a good behavior as one would expect that any unknown DataFrame is just copied to the resulting subnet.

Of course this could lead to invalid data being in the subnet but it is better to have data that is no longer valid (for example if it references a bus that is not part of the subnet) than loosing information all together. The Documentation should mention this behavior regardless of the chosen option.

Expected Behavior

I would expect the example DataFrame to be present in the selected subnet.

Installed Versions

Label

vogt31337 commented 5 days ago

maybe we should introduce a switch copy_unused_dataframes, which would simply copy such dataframes into all subnets, without touching them.

SteffenMeinecke commented 2 days ago

There already is the flag keep_everything_else. @KS-HTK, you can improve the docstring to avoid that the next user is missing the existing functionality.

PS: please close the issue if it can be closed.