Sample  type: sample#

class lumen.transforms.base.Sample(*, frac, n, replace, controls, name)#

Sample returns a random sample of items.

df.sample(n=<n>, frac=<frac>, replace=<replace>)


Parameters#

frac

type: Number
default: None
bounds: (0, 1)
Fraction of axis items to return.

n

type: int
default: None
bounds: None
Number of items to return.

replace

type: bool
default: False
Sample with or without replacement.


Methods#

Sample.apply(table: DataFrame) DataFrame#

Given a table transform it in some way and return it.

Parameters:

table (DataFrame) – The queried table as a DataFrame.

Returns:

A DataFrame containing the transformed data.

Return type:

DataFrame

Sample.to_spec(context: Dict[str, Any] | None = None) Dict[str, Any]#

Exports the full specification to reconstruct this component.

Return type:

Resolved and instantiated Component object