random_sample

random_sample#

Catalog.random_sample(n: int = 5, seed: int | None = None) NestedFrame#

Returns a few randomly sampled rows, like self.sample(), except that it randomly samples all partitions in order to fulfill the rows.

Parameters:
nint, default 5

The number of desired rows.

seedint or None, default None

Random seed

Returns:
npd.NestedFrame

A NestedFrame with up to n rows of data.

Notes

As with .sample, n is an approximate number of items to return. The exact number of elements selected will depend on how your data is partitioned. (In practice, it should be pretty close.)

The seed argument is passed directly to random.seed in order to assist with creating predictable outputs when wanted, such as in unit tests.