polars.testing.column#
- class polars.testing.column(name: str, dtype: PolarsDataType | None = None, strategy: SearchStrategy[pli.Series] | None = None, null_probability: float | None = None, unique: bool = False)#
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 >>> pl.testing.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) >>> pl.testing.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)
- Attributes
- dtype
- null_probability
- strategy
- __init__(name: str, dtype: PolarsDataType | None = None, strategy: SearchStrategy[pli.Series] | None = None, null_probability: float | None = None, unique: bool = False) None #
Methods
__init__
(name[, dtype, strategy, ...])Attributes
dtype
null_probability
strategy
unique
name