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(python): added all missing examples for temporal expressions #6488

Merged

Conversation

romanovacca
Copy link
Contributor

Added examples for:

  • strftime
  • iso_year
  • cast_time_zone
  • tz_localize

Note: I did not add examples for some functions that are going to be unified together. See #6445 for more info on this.

Comment on lines +418 to +420
>>> start = datetime(2001, 1, 1)
>>> stop = datetime(2006, 1, 1)
>>> df = pl.DataFrame({"date": pl.date_range(start, stop, timedelta(days=180))})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seem to be a big fan of date_range 😄 I think the examples are fine, but would probably be clearer if you just hardcoded three datetimes in a dataframe. You already specified a start and stop, you're 2/3rds of the way there 😄

Copy link
Contributor Author

@romanovacca romanovacca Jan 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I could do that, but most of the other functions for expressions use date_range to make a couple examples, so I used this so it's in line with the other examples.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I agree I can trim down the amount of rows in this example, the amount now is a bit overkill

@ritchie46
Copy link
Member

Thank you @romanovacca and @stinodego for the review.

@ritchie46 ritchie46 changed the title added all missing examples for temporal expressions docs(python): added all missing examples for temporal expressions Jan 27, 2023
@ritchie46 ritchie46 merged commit e4928be into pola-rs:master Jan 27, 2023
@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars labels Jan 27, 2023
@romanovacca romanovacca deleted the temporal_expressions_documentation branch October 1, 2023 11:26
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants