Skip to content

DOC: Fixing EX01 - Added examples #53948

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 9 commits into from
Jul 5, 2023
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
4 changes: 0 additions & 4 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas_object \
pandas.api.interchange.from_dataframe \
pandas.DatetimeIndex.snap \
pandas.core.window.rolling.Rolling.max \
pandas.core.window.rolling.Rolling.cov \
pandas.core.window.rolling.Rolling.skew \
pandas.core.window.rolling.Rolling.apply \
pandas.core.window.rolling.Window.mean \
pandas.core.window.rolling.Window.sum \
pandas.core.window.rolling.Window.var \
Expand Down
63 changes: 59 additions & 4 deletions pandas/core/window/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,19 @@ def count(self, numeric_only: bool = False):
create_section_header("Returns"),
template_returns,
create_section_header("See Also"),
template_see_also[:-1],
template_see_also,
create_section_header("Examples"),
dedent(
"""\
>>> ser = pd.Series([1, 6, 5, 4])
>>> ser.rolling(2).apply(lambda s: s.sum() - s.min())
0 NaN
1 6.0
2 6.0
3 5.0
dtype: float64
"""
),
window_method="rolling",
aggregation_description="custom aggregation function",
agg_method="apply",
Expand Down Expand Up @@ -2008,7 +2020,19 @@ def sum(
create_section_header("See Also"),
template_see_also,
create_section_header("Notes"),
numba_notes[:-1],
numba_notes,
create_section_header("Examples"),
dedent(
"""\
>>> ser = pd.Series([1, 2, 3, 4])
>>> ser.rolling(2).max()
0 NaN
1 2.0
2 3.0
3 4.0
dtype: float64
"""
),
window_method="rolling",
aggregation_description="maximum",
agg_method="max",
Expand Down Expand Up @@ -2288,7 +2312,25 @@ def var(
"scipy.stats.skew : Third moment of a probability density.\n",
template_see_also,
create_section_header("Notes"),
"A minimum of three periods is required for the rolling calculation.\n",
dedent(
"""
A minimum of three periods is required for the rolling calculation.\n
"""
),
create_section_header("Examples"),
dedent(
"""\
>>> ser = pd.Series([1, 5, 2, 7, 12, 6])
>>> ser.rolling(3).skew().round(6)
0 NaN
1 NaN
2 1.293343
3 -0.585583
4 0.000000
5 1.545393
dtype: float64
"""
),
window_method="rolling",
aggregation_description="unbiased skewness",
agg_method="skew",
Expand Down Expand Up @@ -2538,7 +2580,20 @@ def rank(
create_section_header("Returns"),
template_returns,
create_section_header("See Also"),
template_see_also[:-1],
template_see_also,
create_section_header("Examples"),
dedent(
"""\
>>> ser1 = pd.Series([1, 2, 3, 4])
>>> ser2 = pd.Series([1, 4, 5, 8])
>>> ser1.rolling(2).cov(ser2)
0 NaN
1 1.5
2 0.5
3 1.5
dtype: float64
"""
),
window_method="rolling",
aggregation_description="sample covariance",
agg_method="cov",
Expand Down