diff --git a/src/fmu/ensemble/realization.py b/src/fmu/ensemble/realization.py index 71e0ccfb..ee41a574 100644 --- a/src/fmu/ensemble/realization.py +++ b/src/fmu/ensemble/realization.py @@ -523,7 +523,6 @@ def load_status(self): status.fillna("", inplace=True) errorjobs = status[errorcolumns[0]] != "" - # Merge any error strings: error_string = ( status.loc[errorjobs, errorcolumns] @@ -531,7 +530,7 @@ def load_status(self): .apply(" ".join, axis=1) .apply(str.strip) ) - status["errorstring"] = np.nan + status["errorstring"] = pd.NA status.loc[errorjobs, "errorstring"] = error_string status.drop(errorcolumns, axis=1, inplace=True) diff --git a/src/fmu/ensemble/virtualrealization.py b/src/fmu/ensemble/virtualrealization.py index 95f9a17f..1dbbcccf 100644 --- a/src/fmu/ensemble/virtualrealization.py +++ b/src/fmu/ensemble/virtualrealization.py @@ -381,15 +381,10 @@ def get_smry(self, column_keys=None, time_index="monthly"): ] if cum_columns: smry[cum_columns] = ( - smry[cum_columns] - .interpolate(method="time") - .fillna(method="ffill") - .fillna(method="bfill") + smry[cum_columns].interpolate(method="time").ffill().bfill() ) if noncum_columns: - smry[noncum_columns] = ( - smry[noncum_columns].fillna(method="bfill").fillna(value=0) - ) + smry[noncum_columns] = smry[noncum_columns].bfill().fillna(value=0) smry.index = smry.index.set_names(["DATE"]) return smry.loc[pd.to_datetime(time_index_dt)] diff --git a/tests/test_ensemble.py b/tests/test_ensemble.py index 82b8d282..761fa296 100644 --- a/tests/test_ensemble.py +++ b/tests/test_ensemble.py @@ -544,7 +544,8 @@ def test_ensemble_ecl(): # For oil industry, p15 on FOPT should yield a larger value than p85. # But the quantiles we get out follows the rest of the world # so we check for the opposite. - assert df_stats["FOPT"]["p85"][-1] > df_stats["FOPT"]["p15"][-1] + + assert df_stats["FOPT"]["p85"].iloc[-1] > df_stats["FOPT"]["p15"].iloc[-1] with pytest.raises(ValueError): reekensemble.get_smry_stats( diff --git a/tests/test_realization.py b/tests/test_realization.py index 6210eebd..91c490b5 100644 --- a/tests/test_realization.py +++ b/tests/test_realization.py @@ -381,7 +381,9 @@ def test_volumetric_rates(): # Calculate cumulative production from the computed volumetric daily rates: dayscum["FOPRcum"] = dayscum["FOPR"] * dayscum["DIFFDAYS"] # Check that this sum is equal to FOPT between first and last date: - assert dayscum["FOPRcum"].sum() == pytest.approx(dcum["FOPT"][-1] - dcum["FOPT"][0]) + assert dayscum["FOPRcum"].sum() == pytest.approx( + dcum["FOPT"].iloc[-1] - dcum["FOPT"].iloc[0] + ) # (here we could catch an error in case we don't support leap days) # Monthly rates between the random dates: