polars.testing.parametric.column#
- class polars.testing.parametric.column(
- name: str | None = None,
- dtype: PolarsDataType | None = None,
- strategy: SearchStrategy[Any] | None = None,
- allow_null: bool | None = None,
- unique: bool = False,
- null_probability: float | None = None,
Define a column for use with the
dataframes
strategy.Warning
This functionality is currently considered unstable. It may be changed at any point without it being considered a breaking change.
- Parameters:
- namestr
string column name.
- dtypePolarsDataType
a polars dtype.
- strategystrategy, optional
supports overriding the default strategy for the given dtype.
- allow_nullbool, optional
Allow nulls as possible values and allow the
Null
data type by default.- uniquebool, optional
flag indicating that all values generated for the column should be unique.
- null_probabilityfloat, optional
percentage chance (expressed between 0.0 => 1.0) that a generated value is None. this is applied independently of any None values generated by the underlying strategy.
Deprecated since version 0.20.26: Use
allow_null
instead.
Examples
>>> from polars.testing.parametric import column >>> dfs = dataframes( ... [ ... column("x", dtype=pl.Int32, allow_null=True), ... column("y", dtype=pl.Float64), ... ], ... size=2, ... ) >>> dfs.example() shape: (2, 2) ┌───────────┬────────────┐ │ x ┆ y │ │ --- ┆ --- │ │ i32 ┆ f64 │ ╞═══════════╪════════════╡ │ null ┆ 1.1755e-38 │ │ 575050513 ┆ inf │ └───────────┴────────────┘
- __init__(
- name: str | None = None,
- dtype: PolarsDataType | None = None,
- strategy: SearchStrategy[Any] | None = None,
- allow_null: bool | None = None,
- unique: bool = False,
- null_probability: float | None = None,
Methods
__init__
([name, dtype, strategy, ...])Attributes
allow_null
dtype
name
null_probability
strategy
unique