diff --git a/saqc/funcs/interpolation.py b/saqc/funcs/interpolation.py index 97a4c2a6b080a6132e115b419e3d887d105ec7d4..d4b16bbd1fc0a9e7b723e6b36ee3165a3fe39031 100644 --- a/saqc/funcs/interpolation.py +++ b/saqc/funcs/interpolation.py @@ -213,7 +213,7 @@ class InterpolationMixin: method: _SUPPORTED_METHODS, order: int = 2, limit: int | None = 2, - extrapolate: Literal['forward', 'backward', 'both'] = None, + extrapolate: Literal["forward", "backward", "both"] = None, **kwargs, ) -> "SaQC": """ diff --git a/saqc/lib/ts_operators.py b/saqc/lib/ts_operators.py index 3615ce644d0c2a666e773624f8355a83f4cdddf6..0c5533ec063bf3cbd3d5a16fa2a7b0b3a1e9bc1a 100644 --- a/saqc/lib/ts_operators.py +++ b/saqc/lib/ts_operators.py @@ -21,6 +21,7 @@ import pandas as pd from scipy.signal import butter, filtfilt from scipy.stats import iqr, median_abs_deviation from sklearn.neighbors import NearestNeighbors + from saqc.lib.tools import getFreqDelta @@ -351,7 +352,7 @@ def interpolateNANs(data, method, order=2, gap_limit=2, extrapolate=None): # correction for initial gap if isinstance(gap_limit, int): - gap_mask.iloc[:gap_limit]=True + gap_mask.iloc[:gap_limit] = True if gap_limit == 2: # for the common case of gap_limit=2 (default "harmonisation"), we efficiently back propagate the False diff --git a/tests/lib/test_ts_operators.py b/tests/lib/test_ts_operators.py index 63711f4689955d858ed2d3770e39b4c2944891a6..c7288ce2e3f0b9ca62128c4bb312d3808eea7af2 100644 --- a/tests/lib/test_ts_operators.py +++ b/tests/lib/test_ts_operators.py @@ -208,7 +208,7 @@ def test_rateOfChange(data, expected): ), ( 2, - 'backward', + "backward", [np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan], [0, 0, np.nan, np.nan, np.nan, 4, np.nan], ), @@ -226,7 +226,7 @@ def test_rateOfChange(data, expected): ), ( 3, - 'forward', + "forward", [np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan], [np.nan, 0, np.nan, np.nan, np.nan, 4, 4], ), @@ -238,7 +238,7 @@ def test_rateOfChange(data, expected): ), ( 4, - 'both', + "both", [np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan], [np.nan, 0, 1, 2, 3, 4, np.nan], ), @@ -251,8 +251,10 @@ def test_rateOfChange(data, expected): ], ) def test_interpolatNANs(limit, extrapolate, data, expected): - got = interpolateNANs(pd.Series(data), gap_limit=limit, method="linear", extrapolate=extrapolate) + got = interpolateNANs( + pd.Series(data), gap_limit=limit, method="linear", extrapolate=extrapolate + ) try: assert got.equals(pd.Series(expected, dtype=float)) except AssertionError: - print('stop') \ No newline at end of file + print("stop")