Open Idanaviv66 opened 2 months ago
hi @Idanaviv66 I'm all for this, but unfortunately this isn't really possible today, see this docs page for more of an explanation.
An important caveat to static type-linting with pandera dataframe types is that, since pandas dataframes are mutable objects, there’s no way for mypy to know whether a mutated instance of a DataFrameModel-typed dataframe has the correct contents. Fortunately, we can simply rely on the check_types() decorator to verify that the output dataframe is valid.
If you can figure out a way to do this, please feel free to make a PR!
Is your feature request related to a problem? Please describe. Today using pendra does not give static type checking. For example when I have a row set to str, but then try to modify it to int, mypy don't throw an error. Here is example code:
Here the make_red funciton is changing the value from str to int.
Describe the solution you'd like Can use mypy to detect such a problem when setting value that should be str or any other type, to a different type.