Skip to content

Commit

Permalink
Fix accessing preequilibrationConditionId without checking for presen…
Browse files Browse the repository at this point in the history
…ce (#228)

Fixes a bug in petab.visualize.data_overview.create_report which fails if there is no preequilibrationConditionId column in the measurements table.
  • Loading branch information
dweindl authored Oct 17, 2023
1 parent 2c44efe commit 62d5ca8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions petab/visualize/data_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ def get_data_per_observable(measurement_df: pd.DataFrame) -> pd.DataFrame:
"""

my_measurements = measurement_df.copy()
my_measurements[PREEQUILIBRATION_CONDITION_ID] = my_measurements[
PREEQUILIBRATION_CONDITION_ID
].astype("object")

index = [SIMULATION_CONDITION_ID]
if PREEQUILIBRATION_CONDITION_ID in my_measurements:
my_measurements[PREEQUILIBRATION_CONDITION_ID].fillna("", inplace=True)
my_measurements[PREEQUILIBRATION_CONDITION_ID] = (
my_measurements[PREEQUILIBRATION_CONDITION_ID]
.astype("object")
.fillna("", inplace=True)
)
index.append(PREEQUILIBRATION_CONDITION_ID)

data_per_observable = pd.pivot_table(
Expand Down

0 comments on commit 62d5ca8

Please sign in to comment.