-
Notifications
You must be signed in to change notification settings - Fork 13
docs: Add example for SchemaClass.filter() to docstring
#188
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #188 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 53 53
Lines 3005 3005
=========================================
Hits 3005 3005 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8ecac30 to
6849be1
Compare
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.
Thanks, I think it makes sense to have such an example. Would you mind adding it to the Collection class as well? There one receives a dict[str, FailureInfo] in bad.
|
Seems reasonable, but I'm not sure what that example should look like. Can you suggest what the example should look like? Haven't used Collections yet, and the docs don't really have complete enough examples to copy from imo. |
|
One technical aspect to be aware of: I think our sphinx setup will currently not correctly render markdown in docstrings, because those are handled by sphinx.ext.autodoc, which afaict only supports RST (See also here). |
The example can be very similar to the schema example: # Define collection
class HospitalInvoiceData(dy.Collection):
invoice: dy.LazyFrame[InvoiceSchema]
...
# Filter the data and cast columns to expected types
good, failure = HospitalInvoiceData.filter(df, cast=True)
# Inspect the reasons for the failed rows for member `invoice`
print(failure.invoice.counts())
# Inspect the failed rows
failed_df = failure.invoice.invalid()
print(failed_df) |
6849be1 to
edb8ba7
Compare
|
Review comments implemented. Rebased. Thanks. |
|
The docs build is still failing with indentation errors. Looking at this docstring, I think you need to also indent |
Motivation
Yesterday, I was bothered when I couldn't find this and had to re-read the quickstart guide.
Today, I still couldn't remember how to do it. There are no hints once you have the
baddataclass instance. Thus, we show the example here.Changes
Added example to docstring. Copied out of quickstart guide. Having this example in two places makes a lot of sense.