-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
docs: add filter docstring examples to date and datetime #15996
docs: add filter docstring examples to date and datetime #15996
Conversation
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.
Nice one!
Couple of suggestions:
- before the example you add, perhaps add an introductory sentence? Like "We can also use
pl.datetime
for filtering", just to distinguish it from the previous example - it may be worth mentioning that
pl.datetime
allows you to overcome the standard library datetime's limitation of non supporting nanoseconds. Maybe the example could show this? You can't construct a nanosecond-precision datetime withdatetime.datetime
, but you can do it with strings, like
df = pl.DataFrame({'start': ['2020-01-01T01:02:03.123456789']})
df.with_columns(pl.col('start').str.to_datetime(time_unit='ns'))
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15996 +/- ##
==========================================
+ Coverage 80.96% 80.98% +0.01%
==========================================
Files 1384 1386 +2
Lines 178102 178382 +280
Branches 3043 3059 +16
==========================================
+ Hits 144194 144454 +260
- Misses 33426 33440 +14
- Partials 482 488 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
should be good, thanks @marenwestermann !
contributes to #13161
I added examples for how to use
polars.date
andpolars.datetime
in combination with row filtering in a dataframe.ping @MarcoGorelli