Skip to content

Commit

Permalink
Update cummax documentation (#3323)
Browse files Browse the repository at this point in the history
Right now, the cummax() documentation uses [1, 2, 3] as its example series. This series isn't the best short example because its cummax is also [1, 2, 3]. It's not immediately clear why passing that as input gets you identical output. The reason the output is identical to the input is that [1, 2, 3] happens to be a monotonically increasing sequence.

The slight change I'm introducing here is an example Series that's *not* monotonically increasing. I think this choice might help users better understand what cummax actually does.
  • Loading branch information
briandk committed May 7, 2022
1 parent 1adce2f commit 4242ca3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions py-polars/polars/internals/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,14 +1109,14 @@ def cummax(self, reverse: bool = False) -> "Series":
Examples
--------
>>> s = pl.Series("a", [1, 2, 3])
>>> s = pl.Series("a", [3, 5, 1])
>>> s.cummax()
shape: (3,)
Series: 'a' [i64]
[
1
2
3
5
5
]
"""
Expand Down

0 comments on commit 4242ca3

Please sign in to comment.