-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
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.
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!
|
||
>>> s = pl.Series([[2, 1, 2], [5, 4, 5]]) |
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.
You don't have to repeat the Series definition as it didn't change.
>>> s = pl.Series([[2, 1, 2], [5, 4, 5]]) |
Examples | ||
-------- | ||
>>> s = pl.Series([[2, 1, 2], [5, 4, 5]]) | ||
>>> s.list.unique() |
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.
This one should be skipped as it may fail (the result is not guaranteed to be in this order).
>>> s.list.unique() | |
>>> s.list.unique() # doctest: +SKIP |
>>> s = pl.Series("a", [1, None, 4]) | ||
>>> s.nan_max() |
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.
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]) |
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.
Same here.
Adding more missing docstrings as discussed here: #13161