polars.testing.parametric.create_list_strategy
-
Create a strategy for generating Polars
Listdata.Deprecated since version 0.20.26: Use
lists()instead.- Parameters:
-
-
inner_dtypePolarsDataType -
type of the inner list elements (can also be another List).
-
select_fromlist, optional -
randomly select the innermost values from this list (otherwise the default strategy associated with the innermost dtype is used).
-
sizeint, optional -
if set, generated lists will be of exactly this size (and ignore the min_size/max_size params).
-
min_sizeint, optional -
set the minimum size of the generated lists (default: 0 if unset).
-
max_sizeint, optional -
set the maximum size of the generated lists (default: 3 if min_size is unset or zero, otherwise 2x min_size).
-
uniquebool, optional -
ensure that the generated lists contain unique values.
-
Examples
Create a strategy that generates a list of i32 values:
>>> from polars.testing.parametric import create_list_strategy >>> lst = create_list_strategy(inner_dtype=pl.Int32) >>> lst.example() [-11330, 24030, 116]
polars.testing.parametric.create_list_strategy(
inner_dtype: PolarsDataType | None = None,
*,
select_from: Sequence[Any] | None = None,
size: int | None = None,
min_size: int = 0,
max_size: int | None = None,
unique: bool = False,
) → SearchStrategy[list[Any]]
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/api/polars.testing.parametric.create_list_strategy.html