Sample Paths

Randomly sample paths (and all their events).

Exactly one of n or frac must be provided (mirrors pandas.DataFrame.sample).

Usage

stream.sample_paths(n=1000)
stream.sample_paths(frac=0.1, random_state=42)  # 10 % of paths

Parameters

ParameterTypeDescription
nint, optionalNumber of paths to keep.
fracfloat, optionalFraction of total paths to keep, in the range (0.0, 1.0]. Passing 1.0 returns the eventstream unchanged.
random_stateint, optionalSeed for the random number generator; pass an integer for reproducible results.
path_colstr, optionalPath ID column override; defaults to schema.path_col.