Data preparation#
Clean a series before analysis: fill or drop missing values, and despike outliers.
Missing data#
Filling and removing NaN values.
Function |
Description |
|---|---|
Drop events whose value is NaN. |
|
Replace NaN with the most recent finite value. |
|
Replace NaN with a user-specified scalar. |
|
Returns 1.0 for finite values, 0.0 for NaN or inf. Does not propagate NaN. |
|
Returns 1.0 if the input is NaN, else 0.0. Does not propagate NaN. |
Outliers & robustness#
Despiking and robust estimators.
Function |
Description |
|---|---|
Bound each element below and/or above. |
|
Robust Hampel despiker, replace samples far from the window median (in MAD units). |
|
Causal impulse remover, detects spikes on the trend-free first difference. |
|
Trailing-window mean absolute deviation from the rolling mean. |
|
Trailing-window median. |
|
Rolling median absolute deviation, median(|x - median|), a robust scale estimate. |
|
Replace samples outside [mean - lower*std, mean + upper*std] with NaN or the clipped bound. |