Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] select_subnet loses dataframes #2333

Open
6 tasks done
KS-HTK opened this issue Jul 5, 2024 · 2 comments
Open
6 tasks done

[bug] select_subnet loses dataframes #2333

KS-HTK opened this issue Jul 5, 2024 · 2 comments
Labels

Comments

@KS-HTK
Copy link
Collaborator

KS-HTK commented Jul 5, 2024

Bug report checklis

  • Searched the issues page for similar reports

  • Read the relevant sections of the documentation

  • Browse the tutorials and tests for usefull code snippets and examples of use

  • Reproduced the issue after updating with pip install --upgrade pandapower (or git pull)

  • Tried basic troubleshooting (if a bug/error) like restarting the interpreter and checking the pythonpath

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

  • python version: 3.9.13
  • pandas version: 2.2.2
  • networkx version: 3.2.1
  • scipy version: 1.13.1
  • numpy version: 2.0.0
  • packaging version: 24.1
  • tqdm version: 4.66.4
  • deepdiff version: 7.0.1
  • Operating System name/version: Windows 10 Enterprise / 22H2

Label

  • Relevant labels are selected
@KS-HTK KS-HTK added the bug label Jul 5, 2024
@vogt31337
Copy link
Contributor

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

@SteffenMeinecke
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants