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): Improve docstrings for ewm_* and rolling_* methods #14667

Merged
merged 2 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5538,11 +5538,6 @@ def rolling(
not be 24 hours, due to daylight savings). Similarly for "calendar week",
"calendar month", "calendar quarter", and "calendar year".

In case of a rolling operation on an integer column, the windows are defined by:

- **"1i" # length 1**
- **"10i" # length 10**

Parameters
----------
index_column
Expand Down
93 changes: 33 additions & 60 deletions py-polars/polars/expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3339,11 +3339,6 @@ def rolling(
not be 24 hours, due to daylight savings). Similarly for "calendar week",
"calendar month", "calendar quarter", and "calendar year".

In case of a rolling operation on an integer column, the windows are defined by:

- "1i" # length 1
- "10i" # length 10

Parameters
----------
index_column
Expand Down Expand Up @@ -5716,16 +5711,13 @@ def rolling_min(
If `by` has not been specified (the default), the window at a given row will
include the row itself, and the `window_size - 1` elements before it.

If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="left"`
means the windows will be:
If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="right"`
(the default) means the windows will be:

- [t_0 - window_size, t_0)
- [t_1 - window_size, t_1)
- (t_0 - window_size, t_0]
- (t_1 - window_size, t_1]
- ...
- [t_n - window_size, t_n)

With `closed="right"`, the left endpoint is not included and the right
endpoint is included.
- (t_n - window_size, t_n]

Parameters
----------
Expand Down Expand Up @@ -5931,16 +5923,13 @@ def rolling_max(
If `by` has not been specified (the default), the window at a given row will
include the row itself, and the `window_size - 1` elements before it.

If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="left"`
means the windows will be:
If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="right"`
(the default) means the windows will be:

- [t_0 - window_size, t_0)
- [t_1 - window_size, t_1)
- (t_0 - window_size, t_0]
- (t_1 - window_size, t_1]
- ...
- [t_n - window_size, t_n)

With `closed="right"`, the left endpoint is not included and the right
endpoint is included.
- (t_n - window_size, t_n]

Parameters
----------
Expand Down Expand Up @@ -6171,16 +6160,13 @@ def rolling_mean(
If `by` has not been specified (the default), the window at a given row will
include the row itself, and the `window_size - 1` elements before it.

If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="left"`
means the windows will be:
If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="right"`
(the default) means the windows will be:

- [t_0 - window_size, t_0)
- [t_1 - window_size, t_1)
- (t_0 - window_size, t_0]
- (t_1 - window_size, t_1]
- ...
- [t_n - window_size, t_n)

With `closed="right"`, the left endpoint is not included and the right
endpoint is included.
- (t_n - window_size, t_n]

Parameters
----------
Expand Down Expand Up @@ -6421,16 +6407,13 @@ def rolling_sum(
If `by` has not been specified (the default), the window at a given row will
include the row itself, and the `window_size - 1` elements before it.

If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="left"`
means the windows will be:
If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="right"`
(the default) means the windows will be:

- [t_0 - window_size, t_0)
- [t_1 - window_size, t_1)
- (t_0 - window_size, t_0]
- (t_1 - window_size, t_1]
- ...
- [t_n - window_size, t_n)

With `closed="right"`, the left endpoint is not included and the right
endpoint is included.
- (t_n - window_size, t_n]

Parameters
----------
Expand Down Expand Up @@ -6666,8 +6649,6 @@ def rolling_std(
- ...
- [t_n - window_size, t_n)

With `closed="right"`, the left endpoint is not included and the right
endpoint is included.

Parameters
----------
Expand Down Expand Up @@ -6908,16 +6889,13 @@ def rolling_var(
If `by` has not been specified (the default), the window at a given row will
include the row itself, and the `window_size - 1` elements before it.

If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="left"`
means the windows will be:
If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="right"`
(the default) means the windows will be:

- [t_0 - window_size, t_0)
- [t_1 - window_size, t_1)
- (t_0 - window_size, t_0]
- (t_1 - window_size, t_1]
- ...
- [t_n - window_size, t_n)

With `closed="right"`, the left endpoint is not included and the right
endpoint is included.
- (t_n - window_size, t_n]

Parameters
----------
Expand Down Expand Up @@ -7165,8 +7143,6 @@ def rolling_median(
- ...
- [t_n - window_size, t_n)

With `closed="right"`, the left endpoint is not included and the right
endpoint is included.

Parameters
----------
Expand Down Expand Up @@ -7319,16 +7295,13 @@ def rolling_quantile(
If `by` has not been specified (the default), the window at a given row will
include the row itself, and the `window_size - 1` elements before it.

If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="left"`
means the windows will be:
If you pass a `by` column `<t_0, t_1, ..., t_n>`, then `closed="right"`
(the default) means the windows will be:

- [t_0 - window_size, t_0)
- [t_1 - window_size, t_1)
- (t_0 - window_size, t_0]
- (t_1 - window_size, t_1]
- ...
- [t_n - window_size, t_n)

With `closed="right"`, the left endpoint is not included and the right
endpoint is included.
- (t_n - window_size, t_n]

Parameters
----------
Expand Down Expand Up @@ -8587,7 +8560,7 @@ def ewm_mean(
Divide by decaying adjustment factor in beginning periods to account for
imbalance in relative weightings

- When `adjust=True` the EW function is calculated
- When `adjust=True` (the default) the EW function is calculated
using weights :math:`w_i = (1 - \alpha)^i`
- When `adjust=False` the EW function is calculated
recursively by
Expand Down Expand Up @@ -8686,7 +8659,7 @@ def ewm_std(
Divide by decaying adjustment factor in beginning periods to account for
imbalance in relative weightings

- When `adjust=True` the EW function is calculated
- When `adjust=True` (the default) the EW function is calculated
using weights :math:`w_i = (1 - \alpha)^i`
- When `adjust=False` the EW function is calculated
recursively by
Expand Down Expand Up @@ -8788,7 +8761,7 @@ def ewm_var(
Divide by decaying adjustment factor in beginning periods to account for
imbalance in relative weightings

- When `adjust=True` the EW function is calculated
- When `adjust=True` (the default) the EW function is calculated
using weights :math:`w_i = (1 - \alpha)^i`
- When `adjust=False` the EW function is calculated
recursively by
Expand Down
5 changes: 0 additions & 5 deletions py-polars/polars/lazyframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3277,11 +3277,6 @@ def rolling(
not be 24 hours, due to daylight savings). Similarly for "calendar week",
"calendar month", "calendar quarter", and "calendar year".

In case of a rolling operation on an integer column, the windows are defined by:

- "1i" # length 1
- "10i" # length 10

Parameters
----------
index_column
Expand Down
6 changes: 3 additions & 3 deletions py-polars/polars/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -6798,7 +6798,7 @@ def ewm_mean(
Divide by decaying adjustment factor in beginning periods to account for
imbalance in relative weightings

- When `adjust=True` the EW function is calculated
- When `adjust=True` (the default) the EW function is calculated
using weights :math:`w_i = (1 - \alpha)^i`
- When `adjust=False` the EW function is calculated
recursively by
Expand Down Expand Up @@ -6880,7 +6880,7 @@ def ewm_std(
Divide by decaying adjustment factor in beginning periods to account for
imbalance in relative weightings

- When `adjust=True` the EW function is calculated
- When `adjust=True` (the default) the EW function is calculated
using weights :math:`w_i = (1 - \alpha)^i`
- When `adjust=False` the EW function is calculated
recursively by
Expand Down Expand Up @@ -6965,7 +6965,7 @@ def ewm_var(
Divide by decaying adjustment factor in beginning periods to account for
imbalance in relative weightings

- When `adjust=True` the EW function is calculated
- When `adjust=True` (the default) the EW function is calculated
using weights :math:`w_i = (1 - \alpha)^i`
- When `adjust=False` the EW function is calculated
recursively by
Expand Down
Loading