Skip to content

DOC: Closed parameter not intuitively documented in DataFrame.rolling #60832

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

Merged
merged 4 commits into from
Feb 3, 2025
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
17 changes: 12 additions & 5 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -3710,14 +3710,21 @@ def rolling(
an integer index is not used to calculate the rolling window.

closed : str, default None
If ``'right'``, the first point in the window is excluded from calculations.
Determines the inclusivity of points in the window
If ``'right'``, (First, Last] the last point in the window
is included in the calculations.

If ``'left'``, the last point in the window is excluded from calculations.
If ``'left'``, [First, Last) the first point in the window
is included in the calculations.

If ``'both'``, no points in the window are excluded from calculations.
If ``'both'``, [First, Last] all points in the window
are included in the calculations.

If ``'neither'``, the first and last points in the window are excluded
from calculations.
If ``'neither'``, (First, Last) the first and last points
in the window are excludedfrom calculations.

() and [] are referencing open and closed set
notation respetively.

Default ``None`` (``'right'``).

Expand Down
17 changes: 12 additions & 5 deletions pandas/core/window/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,14 +929,21 @@ class Window(BaseWindow):
an integer index is not used to calculate the rolling window.

closed : str, default None
If ``'right'``, the first point in the window is excluded from calculations.
Determines the inclusivity of points in the window
If ``'right'``, (First, Last] the last point in the window
is included in the calculations.

If ``'left'``, the last point in the window is excluded from calculations.
If ``'left'``, [First, Last) the first point in the window
is included in the calculations.

If ``'both'``, no point in the window is excluded from calculations.
If ``'both'``, [First, Last] all points in the window
are included in the calculations.

If ``'neither'``, the first and last points in the window are excluded
from calculations.
If ``'neither'``, (First, Last) the first and last points
in the window are excludedfrom calculations.

() and [] are referencing open and closed set
notation respetively.

Default ``None`` (``'right'``).

Expand Down