From 281a1f330082a5c5503e10b3c29ea3634fb21017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Berland?= Date: Tue, 11 Oct 2022 10:40:58 +0200 Subject: [PATCH] Resolve FutureWarnigns from pandas 1.5.0 --- pyscal/utils/monotonicity.py | 2 +- pyscal/utils/testing.py | 10 +++++----- tests/test_slgof.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyscal/utils/monotonicity.py b/pyscal/utils/monotonicity.py index 4327522b..29baba78 100644 --- a/pyscal/utils/monotonicity.py +++ b/pyscal/utils/monotonicity.py @@ -89,7 +89,7 @@ def modify_dframe_monotonicity( # Prepare and check columns: for col in monotonicity: if dframe[col].dtype != np.float64: - dframe.loc[:, col] = dframe[col].astype(float) + dframe[col] = dframe[col].astype(float) # Bail on clearly erroneous data: check_almost_monotone(dframe[col], digits, monotonicity[col]["sign"]) diff --git a/pyscal/utils/testing.py b/pyscal/utils/testing.py index 10d130a8..29e9e851 100644 --- a/pyscal/utils/testing.py +++ b/pyscal/utils/testing.py @@ -129,16 +129,16 @@ def check_table(dframe: pd.DataFrame) -> None: if "SW" in dframe and "SG" not in dframe: # (avoiding GasWater tables, where sw is an auxiliary column) assert len(dframe["SW"].unique()) == len(dframe) - assert dframe["SW"].is_monotonic + assert dframe["SW"].is_monotonic_increasing assert (dframe["SW"] >= 0.0).all() - assert dframe["SWN"].is_monotonic + assert dframe["SWN"].is_monotonic_increasing assert dframe["SON"].is_monotonic_decreasing - assert dframe["SWNPC"].is_monotonic + assert dframe["SWNPC"].is_monotonic_increasing if "SG" in dframe: assert len(dframe["SG"].unique()) == len(dframe) - assert dframe["SG"].is_monotonic + assert dframe["SG"].is_monotonic_increasing assert (dframe["SG"] >= 0.0).all() - assert dframe["SGN"].is_monotonic + assert dframe["SGN"].is_monotonic_increasing assert dframe["SON"].is_monotonic_decreasing if "KROW" in dframe: assert series_decreasing(dframe["KROW"]) diff --git a/tests/test_slgof.py b/tests/test_slgof.py index d7302f3a..d25b5466 100644 --- a/tests/test_slgof.py +++ b/tests/test_slgof.py @@ -14,7 +14,7 @@ def check_table(dframe): """Check sanity of important columns""" assert not dframe.empty assert not dframe.isnull().values.any() - assert dframe["SL"].is_monotonic + assert dframe["SL"].is_monotonic_increasing assert (dframe["SL"] >= 0.0).all() assert (dframe["SL"] <= 1.0).all() # Increasing, but not monotonically for slgof