detect_interpolation(x, window=6, rtol=1e-05, atol=1e-08)¶
Detects sequences of data which appear linear.
Sequences are linear if the first difference appears to be constant. For a window of length N, the last value (index N-1) is flagged if all values in the window appear to be a line segment.
- x (series) – data to be processed
- window (int, default 6) – number of sequential values that, if the first difference is constant, are classified as a linear sequence
- rtol (float, default 1e-5) – tolerance relative to max(abs(x.diff()) for detecting a change
- atol (float, default 1e-8) – absolute tolerance for detecting a change in first difference
flags (Series) – True if the value is part of a linear sequence
ValueError if window < 3