Open antonioalegria opened 2 months ago
Workaround: use pl.Category
in the schema and the isin
checker.
Ideally we would be able to use Literal['a', 'b', 'c'] as the column type in the model, but that doesn't seem to be supported (another error is thrown when converting the model to schema).
Describe the bug A clear and concise description of what the bug is.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Exception: pandera.errors.SchemaError: expected column 'a' to have type Datetime(time_unit='us', time_zone=None), got String
When checking the
df
in debug mode, we see that it's after the coerce of columnb
that columna
becomes converted to str.Expected behavior
The dataframe should've been validated and no types changed in this case. Column
b
should be coerced to pl.Category.Desktop (please complete the following information):
OS: macOS 14.6.1 Python 3.12.4 polars-lts-cpu 1.6.0 pandera 0.20.3
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.