Data preparation#

Prepare a series before analysis: bars from ticks, fill or drop missing values, and despike outliers.

Bars & resampling#

Time, tick, volume, and dollar bars from a trade tape, and OHLC downsampling.

Function

Description

Resample

Causal windowed downsample of a 1-D or multi-column value stream.

Missing data#

Filling and removing NaN values.

Function

Description

Dropna

Drop events whose value is NaN.

Forward-fill NaNs

Replace NaN with the most recent non-NaN value.

Replace NaNs with a constant

Replace NaN with a user-specified scalar.

IsFinite

Returns 1.0 for finite values, 0.0 for NaN or inf. Does not propagate NaN.

IsNan

Returns 1.0 if the input is NaN, else 0.0. Does not propagate NaN.

Outliers & robustness#

Despiking and robust estimators.

Function

Description

Clip to bounds

Bound each element below and/or above.

Hampel filter

Robust Hampel despiker, replace samples far from the window median (in MAD units).

Impulse clip

Causal impulse remover, detects spikes on the trend-free first difference.

Rolling mean absolute deviation

Trailing-window mean absolute deviation from the rolling mean.

Rolling median

Trailing-window median.

Rolling median absolute deviation

Rolling median absolute deviation, median(|x - median|), a robust scale estimate.

Rolling sigma-clip

Clip samples that lie beyond lower or upper standard deviations from the rolling mean, or replace them with NaN.