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

update of df for multiple rows fails/not user friendly #485

Open
AnkurArohi opened this issue Aug 30, 2022 · 2 comments
Open

update of df for multiple rows fails/not user friendly #485

AnkurArohi opened this issue Aug 30, 2022 · 2 comments

Comments

@AnkurArohi
Copy link

AnkurArohi commented Aug 30, 2022

  • Do you want to request a feature or report a bug?

  • What is the current behavior?
    Trying to set a boolean value for all rows in generator df is difficult/leads to error

    powsybl_net is powsybl network

    a = powsybl_net.get_generators()
    a.voltage_regulator_on = True
    powsybl_net.update_generators(a)

    Error

    Traceback (most recent call last):

      return self._update_elements(ElementType.GENERATOR, df, **kwargs)
    

    , line 2103, in _update_elements
    _pp.update_network_elements_with_series(self._handle, c_df, element_type)
    pypowsybl._pypowsybl.PyPowsyblError: Series 'name' is not modifiable.

    Although

    a.name==powsybl_net.get_generators().name

    Is True for all rows

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

  • What is the expected behavior?
    It should be easy to update column values for each row in df

something like this

powsybl_net.get_generators().loc[:,"voltage_regulator_on"] = True

  • What is the motivation / use case for changing the behavior?

User friendliness

  • Please tell us about your environment:

    • PowSyBl Version: ...
    • OS Version: ...
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, spectrum, etc)

(if a question doesn't apply, you can delete it)

@AnkurArohi AnkurArohi changed the title update of df fails update of df for multiple rows fails/not user friendly Aug 30, 2022
@EtienneLt
Copy link
Contributor

EtienneLt commented Aug 30, 2022

Hello, you can do it like that

net.update_generators(id=net.get_generators().index, voltage_regulator_on=[True]*len(net.get_generators().index))

@AnkurArohi
Copy link
Author

AnkurArohi commented Aug 30, 2022

Hello, you can do it like that

net.update_generators(id=net.get_generators().index, voltage_regulator_on=[True]*len(net.get_generators().index))

Thanks for your reply, Yes but I find this not user friendly, thats why i mentioned that this is not a bug, but this is according to me not an elegant way of doing it

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

No branches or pull requests

2 participants