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
The initial example in the documentation shows validation of a LazyFrame but requires .collect(), which is confusing
The example code has type checking errors with modern type checkers, pylance at "basic"
Return types from validate() don't properly indicate Polars methods
Example of current type errors:
and example in my code: .
This would help new users better understand the intended usage pattern and avoid confusion with type checking.
I am running into a lot of basic level type checking errors using pandera. I'm quite new to type checking, but trying to write more robust code and thus use proper validation on my data when using polars.
Wording
The docs also say which we then use to validate a polars.LazyFrame object. Which is weird since the code beneath needs to 'collect' to validate, thus forgoing the lazy optimizations?
Suggested fix for documentation
I don't really know what the cause of this is or how to improve it, but i keep running into a lot of type errors when using pandera.
Suggested Improvements:
Update the initial example to clearly show the recommended validation pattern
Add proper type hints for Pandera's return types
Move the explanation of LazyFrame vs DataFrame validation earlier in the docs
The text was updated successfully, but these errors were encountered:
The call to typing.cast does not change the functionality of the code at all; it just tells the type checker to expect a LazyFrame that follows the Schema specification.
This is necessary when using the class-based API: https://pandera.readthedocs.io/en/latest/dataframe_models.html. The pandera.typing.polars module is the polars version of pandera.typing from the link. There is a reference to it in the docs on the polars side, but not until the next section.
I would be happy to submit a PR to tweak these docs; I had a little difficulty in sorting through this when switching from the pandas to the polars engine. My thought would be to make a small change to reference the later sections from the start, and to more explicitly discuss the pandera.polars.typing module.
Location of the documentation
https://pandera.readthedocs.io/en/latest/polars.html
Documentation problem
Issues:
.collect()
, which is confusingExample of current type errors:
![image](https://private-user-images.githubusercontent.com/7408635/388996044-dc6d6b06-c118-4d20-953f-1487cbbf54b4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjc2MDcsIm5iZiI6MTczOTEyNzMwNywicGF0aCI6Ii83NDA4NjM1LzM4ODk5NjA0NC1kYzZkNmIwNi1jMTE4LTRkMjAtOTUzZi0xNDg3Y2JiZjU0YjQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDlUMTg1NTA3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzdkOTU3YTI1MTQwZjkxOTc2M2Q1NWQwY2YxMDUyZGIyMjNhNGRkZDlhMTljYmZhZTQzYzZkYTQxMjExODY2MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ypojAIpB6OKKRNKZO606DjfoY8GKuoybmMU5rZO-u28)
and example in my code:
.
This would help new users better understand the intended usage pattern and avoid confusion with type checking.
I am running into a lot of basic level type checking errors using pandera. I'm quite new to type checking, but trying to write more robust code and thus use proper validation on my data when using polars.
Wording
The docs also say
which we then use to validate a polars.LazyFrame object.
Which is weird since the code beneath needs to 'collect' to validate, thus forgoing the lazy optimizations?Suggested fix for documentation
I don't really know what the cause of this is or how to improve it, but i keep running into a lot of type errors when using pandera.
Suggested Improvements:
The text was updated successfully, but these errors were encountered: