polars.testing.parametric.column#

class polars.testing.parametric.column(name: str, dtype: Optional[Union[Type[DataType], DataType]] = None, strategy: Optional[SearchStrategy[Series | int]] = None, null_probability: float | None = None, unique: bool = False)[source]#

Define a column for use with the @dataframes strategy.

Parameters:
namestr

string column name.

dtypedtype

a recognised polars dtype.

strategystrategy, optional

supports overriding the default strategy for the given dtype.

null_probabilityfloat, optional

percentage chance (expressed between 0.0 => 1.0) that a generated value is None. this is applied in addition to any None values output by the given/inferred strategy for the column.

uniquebool, optional

flag indicating that all values generated for the column should be unique.

Examples

>>> from hypothesis.strategies import sampled_from
>>> from polars.testing.parametric import column
>>> column(name="unique_small_ints", dtype=pl.UInt8, unique=True)
column(name='unique_small_ints', dtype=<class 'polars.datatypes.UInt8'>, strategy=None, null_probability=None, unique=True)
>>> column(name="ccy", strategy=sampled_from(["GBP", "EUR", "JPY"]))
column(name='ccy', dtype=<class 'polars.datatypes.Utf8'>, strategy=sampled_from(['GBP', 'EUR', 'JPY']), null_probability=None, unique=False)
__init__(name: str, dtype: Optional[Union[Type[DataType], DataType]] = None, strategy: Optional[SearchStrategy[Series | int]] = None, null_probability: float | None = None, unique: bool = False) None[source]#

Methods

__init__(name[, dtype, strategy, ...])

Attributes

dtype

null_probability

strategy

unique

name