Skip to content
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

Merged
merged 5 commits into from May 5, 2024

Conversation

marenwestermann
Copy link
Contributor

contributes to #13161

I added examples for how to use polars.date and polars.datetime in combination with row filtering in a dataframe.

ping @MarcoGorelli

@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars rust Related to Rust Polars labels May 1, 2024
Copy link
Collaborator

@MarcoGorelli MarcoGorelli left a 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 with datetime.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'))

Copy link

codecov bot commented May 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.98%. Comparing base (be09246) to head (f8d62aa).
Report is 36 commits behind head on main.

❗ Current head f8d62aa differs from pull request most recent head 6d4da52. Consider uploading reports for the commit 6d4da52 to get more accurate results

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     
Flag Coverage Δ
python 74.52% <ø> (+0.06%) ⬆️
rust 78.15% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@MarcoGorelli MarcoGorelli left a 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 !

@ritchie46 ritchie46 merged commit 65e1951 into pola-rs:main May 5, 2024
12 of 13 checks passed
@marenwestermann marenwestermann deleted the docs-date-and-datetime branch May 6, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants