You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/Users/sandro/code/pandera/scalar_returns_polars.py", line 12, in <module>
MyModel(pl.DataFrame({"a": [1]}), lazy=True)
File "/Users/sandro/code/pandera/pandera/api/dataframe/model.py", line 138, in __new__
DataFrameBase[TDataFrameModel], cls.validate(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sandro/code/pandera/pandera/api/dataframe/model.py", line 289, in validate
cls.to_schema().validate(
File "/Users/sandro/code/pandera/pandera/api/polars/container.py", line 58, in validate
output = self.get_backend(check_obj).validate(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sandro/code/pandera/pandera/backends/polars/container.py", line 89, in validate
results = check(*args) # type: ignore[operator]
^^^^^^^^^^^^
File "/Users/sandro/code/pandera/pandera/backends/polars/container.py", line 179, in run_schema_component_checks
result = schema_component.validate(check_obj, lazy=lazy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sandro/code/pandera/pandera/api/polars/components.py", line 146, in validate
output = self.get_backend(check_obj).validate(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sandro/code/pandera/pandera/backends/polars/components.py", line 80, in validate
error_handler = self.run_checks_and_handle_errors(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sandro/code/pandera/pandera/backends/polars/components.py", line 146, in run_checks_and_handle_errors
error_handler.collect_error(
File "/Users/sandro/code/pandera/pandera/api/base/error_handler.py", line 69, in collect_error
else len(schema_error.failure_cases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'bool' has no len()
Expected behavior
A specific SchemaErrors should be raise, like it happens with an analogous pandas-backed model
There is an obvious difference between the handling of scalar False values in the polars backend vs the pandas backend. In the former failure_case remains scalar, which leads to the error when counting failure cases (using lazy=True). Applying an analogous wrapping like scalar_failure_case for pandas seems to work in the very simple case above, but I'm not sure if this approach holds for anything beyond my example.
The text was updated successfully, but these errors were encountered:
Describe the bug
A clear and concise description of what the bug is.
Code Sample, a copy-pastable example
I am using scalar returns for checks on a polars-backed DataFrameModel
which results in the following traceback
Expected behavior
A specific
SchemaErrors
should be raise, like it happens with an analogous pandas-backed modelwhich results in
Desktop (please complete the following information):
Additional context
There is an obvious difference between the handling of scalar False values in the polars backend vs the pandas backend. In the former
failure_case
remains scalar, which leads to the error when counting failure cases (usinglazy=True
). Applying an analogous wrapping likescalar_failure_case
for pandas seems to work in the very simple case above, but I'm not sure if this approach holds for anything beyond my example.The text was updated successfully, but these errors were encountered: