-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
Support for Unions in schemas and validation #1227
base: main
Are you sure you want to change the base?
Conversation
hi @karajan1001 thanks for the contribution! Check out the contribution docs to learn how to run all the linters and tests locally to make sure things are working: https://pandera.readthedocs.io/en/stable/CONTRIBUTING.html |
4453746
to
091335b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1227 /- ##
==========================================
- Coverage 97.23% 93.72% -3.51%
==========================================
Files 65 90 25
Lines 5066 6714 1648
==========================================
Hits 4926 6293 1367
- Misses 140 421 281 ☔ View full report in Codecov by Sentry. |
The coverage failure is what I mentioned in previous that I didn't find a place to add some negative test examples. |
Excuse me, where should I add the negative tests to increase the coverage? |
hi @karajan1001, you can find the parts of the code changes that were not covered in the tests in the "Files changed" tab, e.g. here: https://github.com/unionai-oss/pandera/pull/1227/files#diff-2691db6e54a8a776ed24713a7fa20bc1b86b6361e8a7bf7323722e301c359a76R1357 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we delete the Untitled.ipynb
notebook?
pandera/engines/pandas_engine.py
Outdated
try: | ||
pandera_dtype = Engine.dtype(pandera_dtype) | ||
except TypeError: | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free to create new tests in the test_dtypes.py
file to cover the cases that codecov is complaining about.
fix: unionai-oss#1152 I would like pandera to support Union Type. That is the validation of a Series/Column should allow multiple types. 1. Add a new PythonUnion type. 2. Add a new test to for the new UnionType. Signed-off-by: karajan1001 <[email protected]>
if pandera_dtype not in map(Engine.dtype, pandas_types): | ||
return False | ||
|
||
if data_container is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karajan1001 can we add a test case for when data_container is None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, @cosmicBboy .I'm sorry I do not know how to create a test case in which data_container is None.
I tried
"""
pd.DataDrame{[]}
"""
But it just put an empty pd.Series
in.
any update on this? |
fix: #1152
Make Pandera to support Union Type. That is the validation of a Series/Column should allow multiple types.
It matches all of the requires in the original #1152
And I'm not sure if the tests I added are enough because I didn't know where to add a negative test. Besides this
mypy
will fail and I don't know how to handle it.