Skip to content

KeyError: 'conditionId' #180

@dweindl

Description

@dweindl
  1. Open Bruno benchmark problem
  2. Change some simulationConditionId

expected: No error on the console

actual:

Traceback (most recent call last):
  File "PEtab_GUI/env/lib/python3.13/site-packages/pandas/core/indexes/base.py", line 3812, in get_loc
    return self._engine.get_loc(casted_key)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "pandas/_libs/index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7096, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'conditionId'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "PEtab_GUI/src/petab_gui/controllers/mother_controller.py", line 211, in <lambda>
    else self.condition_controller.maybe_add_condition(x, y)
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "PEtab_GUI/src/petab_gui/controllers/table_controllers.py", line 1039, in maybe_add_condition
    self.model.fill_row(
    ~~~~~~~~~~~~~~~~~~~^
        self.model.get_df().shape[0] - 1,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        data={"conditionId": condition_id},
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "PEtab_GUI/src/petab_gui/models/pandas_table_model.py", line 956, in fill_row
    self.get_default_values(
    ~~~~~~~~~~~~~~~~~~~~~~~^
        self.index(row_position, 0),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        changed=changes,
        ^^^^^^^^^^^^^^^^
    )
    ^
  File "PEtab_GUI/src/petab_gui/models/pandas_table_model.py", line 999, in get_default_values
    default_value = self.default_handler.get_default(
        colname, row_key, changed=changed
    )
  File "PEtab_GUI/src/petab_gui/controllers/default_handler.py", line 69, in get_default
    if np.issubdtype(self.model.dtypes[column_name], np.floating):
                     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "PEtab_GUI/env/lib/python3.13/site-packages/pandas/core/series.py", line 1130, in __getitem__
    return self._get_value(key)
           ~~~~~~~~~~~~~~~^^^^^
  File "PEtab_GUI/env/lib/python3.13/site-packages/pandas/core/series.py", line 1246, in _get_value
    loc = self.index.get_loc(label)
  File "PEtab_GUI/env/lib/python3.13/site-packages/pandas/core/indexes/base.py", line 3819, in get_loc
    raise KeyError(key) from err
KeyError: 'conditionId'

Tested with d484231, petab==0.6.0

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions