Interpolation deletes values when called with `limit` > 2
Summary
When calling interpolateInvalid
(but I guess all other functions/methods routing through lib.ts_operators.interpolateNANs
show the same behavior) with a limit
> 2, the interpolations replaces valid values with np.nan
for gaps larger than limit
.
Reproducible Example
import numpy as np
import pandas as pd
from saqc import SaQC
df = pd.DataFrame(
{"a": [0, np.nan, np.nan, np.nan, np.nan, 5]}
)
qc = SaQC(df)
qc = qc.interpolateInvalid("a", method="linear", limit=3)
What is the current bug behavior?
>>> qc.data["a"]
0 NaN
1 NaN
2 NaN
3 NaN
4 NaN
5 5.0
Name: a, dtype: float64
The method is not supposed to fill any of the NaN
values here, as the gap of 5 consecutive missing values is larger the the limit
of 3. However, we also lost the value 0.0
at index 0
.
What is the expected correct behavior?
>>> qc.data["a"]
0 0.0
1 NaN
2 NaN
3 NaN
4 NaN
5 5.0
Name: a, dtype: float64