@@ -1900,7 +1900,19 @@ def count(self, numeric_only: bool = False):
1900
1900
create_section_header ("Returns" ),
1901
1901
template_returns ,
1902
1902
create_section_header ("See Also" ),
1903
- template_see_also [:- 1 ],
1903
+ template_see_also ,
1904
+ create_section_header ("Examples" ),
1905
+ dedent (
1906
+ """\
1907
+ >>> ser = pd.Series([1, 6, 5, 4])
1908
+ >>> ser.rolling(2).apply(lambda s: s.sum() - s.min())
1909
+ 0 NaN
1910
+ 1 6.0
1911
+ 2 6.0
1912
+ 3 5.0
1913
+ dtype: float64
1914
+ """
1915
+ ),
1904
1916
window_method = "rolling" ,
1905
1917
aggregation_description = "custom aggregation function" ,
1906
1918
agg_method = "apply" ,
@@ -2008,7 +2020,19 @@ def sum(
2008
2020
create_section_header ("See Also" ),
2009
2021
template_see_also ,
2010
2022
create_section_header ("Notes" ),
2011
- numba_notes [:- 1 ],
2023
+ numba_notes ,
2024
+ create_section_header ("Examples" ),
2025
+ dedent (
2026
+ """\
2027
+ >>> ser = pd.Series([1, 2, 3, 4])
2028
+ >>> ser.rolling(2).max()
2029
+ 0 NaN
2030
+ 1 2.0
2031
+ 2 3.0
2032
+ 3 4.0
2033
+ dtype: float64
2034
+ """
2035
+ ),
2012
2036
window_method = "rolling" ,
2013
2037
aggregation_description = "maximum" ,
2014
2038
agg_method = "max" ,
@@ -2288,7 +2312,25 @@ def var(
2288
2312
"scipy.stats.skew : Third moment of a probability density.\n " ,
2289
2313
template_see_also ,
2290
2314
create_section_header ("Notes" ),
2291
- "A minimum of three periods is required for the rolling calculation.\n " ,
2315
+ dedent (
2316
+ """
2317
+ A minimum of three periods is required for the rolling calculation.\n
2318
+ """
2319
+ ),
2320
+ create_section_header ("Examples" ),
2321
+ dedent (
2322
+ """\
2323
+ >>> ser = pd.Series([1, 5, 2, 7, 12, 6])
2324
+ >>> ser.rolling(3).skew().round(6)
2325
+ 0 NaN
2326
+ 1 NaN
2327
+ 2 1.293343
2328
+ 3 -0.585583
2329
+ 4 0.000000
2330
+ 5 1.545393
2331
+ dtype: float64
2332
+ """
2333
+ ),
2292
2334
window_method = "rolling" ,
2293
2335
aggregation_description = "unbiased skewness" ,
2294
2336
agg_method = "skew" ,
@@ -2538,7 +2580,20 @@ def rank(
2538
2580
create_section_header ("Returns" ),
2539
2581
template_returns ,
2540
2582
create_section_header ("See Also" ),
2541
- template_see_also [:- 1 ],
2583
+ template_see_also ,
2584
+ create_section_header ("Examples" ),
2585
+ dedent (
2586
+ """\
2587
+ >>> ser1 = pd.Series([1, 2, 3, 4])
2588
+ >>> ser2 = pd.Series([1, 4, 5, 8])
2589
+ >>> ser1.rolling(2).cov(ser2)
2590
+ 0 NaN
2591
+ 1 1.5
2592
+ 2 0.5
2593
+ 3 1.5
2594
+ dtype: float64
2595
+ """
2596
+ ),
2542
2597
window_method = "rolling" ,
2543
2598
aggregation_description = "sample covariance" ,
2544
2599
agg_method = "cov" ,
0 commit comments