dask.bag.random.choices
dask.bag.random.choices¶
- dask.bag.random.choices(population, k=1)[source]¶
Return a k sized list of elements chosen with replacement.
- Parameters
- population: Bag
Elements to sample.
- k: integer, optional
Number of elements to sample.
Examples
>>> import dask.bag as db >>> from dask.bag import random >>> b = db.from_sequence(range(5), npartitions=2) >>> list(random.choices(b, 3).compute()) [1, 1, 5]