New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly handling single string constraints #670
Conversation
hi @rbngz thanks for the PR! The change you proposed will break the serialization behavior for unary checks, see here: https://github.com/pandera-dev/pandera/runs/4118556698?check_suite_focus=true#step:9:576 So I think the more systemic fix for this issue is to delete this line over here: check.statistics = {
stat: args_dict.get(stat)
for stat in statistics_args
if args_dict.get(stat) is not None # << delete this right here
} The problem is that statistics that are You'll have to update |
Hi @cosmicBboy thank you for the helpful suggestion! Unfortunately, when removing the line that you pointed out, the checks:
in_range:
min_value: 10
max_value: 99
include_min: null
include_max: null Therefore, I needed to exclude the Let me know what you think :) |
hi @rbngz
This is actually the correct behavior, no need to exclude Reading/writing more concise yaml format can be part of another PR, as I agree that keys with But the unit tests will need to be updated so that the all the kwargs are included in the yaml file. |
Codecov Report
@@ Coverage Diff @@
## dev #670 +/- ##
=======================================
Coverage 98.85% 98.85%
=======================================
Files 30 30
Lines 3398 3398
=======================================
Hits 3359 3359
Misses 39 39
Continue to review full report at Codecov.
|
awesome, thanks for the contribution @rbngz! |
* correctly handling single string contraints * formatted changes with black * Switch to a more systemic fix | update tests * including null values for in_range checks Co-authored-by: Gonzalez Avilés, Ruben <ruben.gonzalez_aviles@baloise.com>
* correctly handling single string contraints * formatted changes with black * Switch to a more systemic fix | update tests * including null values for in_range checks Co-authored-by: Gonzalez Avilés, Ruben <ruben.gonzalez_aviles@baloise.com>
Hello
This PR should fix #591
Might also need to check the deserialization, but it seems that this part is correctly handled.
To verify:
Passing the following json to the
from_frictionless_schema()
-function:The frictionless schema is correctly parsed to a pandera schema:
Output:
[<Check str_length: str_length(None, 20)>]
However, serializing the schema to YAML using the
to_yaml()
-function yielded the following output:With proposed changes: