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): Adding additional examples to docstrings #13555

Closed
wants to merge 2 commits into from

Conversation

r-brink
Copy link
Contributor

@r-brink r-brink commented Jan 9, 2024

Adding more missing docstrings as discussed here: #13161

@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars labels Jan 9, 2024
Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

Thanks! A few minor remarks.

EDIT: Seems you were late to the party - a bunch of list examples have already been added recently. Make sure to update your local main branch before writing new stuff!

Comment on lines +299 to +300

>>> s = pl.Series([[2, 1, 2], [5, 4, 5]])
Copy link
Member

Choose a reason for hiding this comment

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

You don't have to repeat the Series definition as it didn't change.

Suggested change
>>> s = pl.Series([[2, 1, 2], [5, 4, 5]])

Examples
--------
>>> s = pl.Series([[2, 1, 2], [5, 4, 5]])
>>> s.list.unique()
Copy link
Member

Choose a reason for hiding this comment

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

This one should be skipped as it may fail (the result is not guaranteed to be in this order).

Suggested change
>>> s.list.unique()
>>> s.list.unique() # doctest: +SKIP

Comment on lines +1865 to +1866
>>> s = pl.Series("a", [1, None, 4])
>>> s.nan_max()
Copy link
Member

Choose a reason for hiding this comment

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

This should showcase a nan value, e.g. float("nan").

Best to give two examples, one where the series has a NaN, one where it doesn't.

@@ -1846,6 +1876,12 @@ def nan_min(self) -> int | float | date | datetime | timedelta | str:
This differs from numpy's `nanmax` as numpy defaults to propagating NaN values,
whereas polars defaults to ignoring them.

Examples
--------
>>> s = pl.Series("a", [1, None, 4])
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

@r-brink r-brink closed this Jan 9, 2024
@r-brink r-brink deleted the more-docs branch January 9, 2024 11:14
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.

2 participants