diff --git a/src/ert/storage/local_ensemble.py b/src/ert/storage/local_ensemble.py index a82a0e2a0b7..a6f9acedbbd 100644 --- a/src/ert/storage/local_ensemble.py +++ b/src/ert/storage/local_ensemble.py @@ -643,7 +643,11 @@ def set_key_index(df, index: List[str]): ) filtered_response = obs_ds.merge(responses_ds, join="left") - df = filtered_response.to_dataframe().reset_index().dropna() + df = ( + filtered_response.to_dataframe() + .reset_index() + .dropna(subset="observations") + ) index = ObservationsIndices[response_type] set_key_index(df, index) @@ -702,7 +706,6 @@ def set_key_index(df, index: List[str]): and not drop_observations_without_response and any(not x.empty for x in observations_without_responses) ): - for df in observations_without_responses: df[long_dfs[0].columns[2:]] = np.nan df.drop(columns=["name"], inplace=True) diff --git a/tests/unit_tests/scenarios/test_summary_response.py b/tests/unit_tests/scenarios/test_summary_response.py index 9309f0a7028..68df5e3d691 100644 --- a/tests/unit_tests/scenarios/test_summary_response.py +++ b/tests/unit_tests/scenarios/test_summary_response.py @@ -238,4 +238,4 @@ def test_that_mismatched_responses_gives_nan_measured_data(ert_config, prior_ens assert fopr_2.loc["STD"].iloc[1] == 0.05 assert pd.isna(fopr_2.loc[0].iloc[1]) assert pd.isna(fopr_2.loc[1].iloc[1]) - assert pd.isna(fopr_1.loc[2].iloc[1]) + assert pd.isna(fopr_2.loc[2].iloc[1])