Skip to content

How-to guides

Recipes for specific problems. Each page assumes you have polars-stats installed and know what a distribution is; if not, start with Getting started or the tutorial.

I want to ... Guide
give every row its own distribution parameters, or derive them from the data Use column-valued parameters
put a distribution inside a LazyFrame query, a window, or a group_by Compose in lazy pipelines
draw random variates that are reproducible across runs and machines Sample reproducibly
decide what happens to null inputs and bad parameters in my pipeline Handle nulls and errors
port existing scipy.stats code Migrate from scipy.stats

For the exact set of accepted inputs and returned dtypes, see Reference / Parameters and contracts. For why the library works this way, see Explanation.