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
| Parameter | Type | Description |
|---|---|---|
n | int, optional | Number of paths to keep. |
frac | float, optional | Fraction of total paths to keep, in the range (0.0, 1.0]. Passing 1.0 returns the eventstream unchanged. |
random_state | int, optional | Seed for the random number generator; pass an integer for reproducible results. |
path_col | str, optional | Path ID column override; defaults to schema.path_col. |