diff --git a/saqc/lib/ts_operators.py b/saqc/lib/ts_operators.py index 8812644f49b32f622bc235f402006b1818b28131..8fbb27e61861121e1932970d6fce5e4476126155 100644 --- a/saqc/lib/ts_operators.py +++ b/saqc/lib/ts_operators.py @@ -331,7 +331,7 @@ def interpolateNANs(data, method, order=2, gap_limit=2, extrapolate=None): # helper variable for checking numerical value of gap limit, if its a numeric value (to avoid comparison to str) gap_check = np.nan if isinstance(gap_limit, str) else gap_limit data = pd.Series(data, copy=True) - limit_area = "inside" if not extrapolate else "outside" + limit_area = None if extrapolate else "inside" if gap_check is None: # if there is actually no limit set to the gaps to-be interpolated, generate a dummy mask for the gaps gap_mask = pd.Series(True, index=data.index, name=data.name) diff --git a/tests/lib/test_ts_operators.py b/tests/lib/test_ts_operators.py index 875e78a80bb67e0e7773bdae349ad8762471282e..9c97b40fa10d0a2ab045adbc3451bf544d2d7d43 100644 --- a/tests/lib/test_ts_operators.py +++ b/tests/lib/test_ts_operators.py @@ -47,10 +47,7 @@ F = False ) def test_exceedConsecutiveNanLimit(arr, maxc, expected): result = tsops._exceedConsecutiveNanLimit(arr, maxc) - try: - assert result is expected - except AssertionError: - print("stop") + assert result is expected def dtSeries(data, freq="1d"): @@ -242,7 +239,7 @@ def test_rateOfChange(data, expected): 4, "both", [np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan], - [np.nan, 0, 1, 2, 3, 4, np.nan], + [0, 0, 1, 2, 3, 4, 4], ), ( None, @@ -256,7 +253,4 @@ def test_interpolatNANs(limit, extrapolate, data, expected): got = tsops.interpolateNANs( pd.Series(data), gap_limit=limit, method="linear", extrapolate=extrapolate ) - try: - assert got.equals(pd.Series(expected, dtype=float)) - except AssertionError: - print("stop") + assert got.equals(pd.Series(expected, dtype=float))