@@ -1270,7 +1270,32 @@ def aggregate(self, func, *args, **kwargs):
1270
1270
create_section_header ("Returns" ),
1271
1271
template_returns ,
1272
1272
create_section_header ("See Also" ),
1273
- template_see_also [:- 1 ],
1273
+ template_see_also ,
1274
+ create_section_header ("Examples" ),
1275
+ dedent (
1276
+ """\
1277
+ >>> ser = pd.Series([0, 1, 5, 2, 8])
1278
+
1279
+ To get an instance of :class:`~pandas.core.window.rolling.Window` we need
1280
+ to pass the parameter `win_type`.
1281
+
1282
+ >>> type(ser.rolling(2, win_type='gaussian'))
1283
+ <class 'pandas.core.window.rolling.Window'>
1284
+
1285
+ In order to use the `SciPy` Gaussian window we need to provide the parameters
1286
+ `M` and `std`. The parameter `M` corresponds to 2 in our example.
1287
+ We pass the second parameter `std` as a parameter of the following method
1288
+ (`sum` in this case):
1289
+
1290
+ >>> ser.rolling(2, win_type='gaussian').sum(std=3)
1291
+ 0 NaN
1292
+ 1 0.986207
1293
+ 2 5.917243
1294
+ 3 6.903450
1295
+ 4 9.862071
1296
+ dtype: float64
1297
+ """
1298
+ ),
1274
1299
window_method = "rolling" ,
1275
1300
aggregation_description = "weighted window sum" ,
1276
1301
agg_method = "sum" ,
@@ -1295,7 +1320,31 @@ def sum(self, numeric_only: bool = False, **kwargs):
1295
1320
create_section_header ("Returns" ),
1296
1321
template_returns ,
1297
1322
create_section_header ("See Also" ),
1298
- template_see_also [:- 1 ],
1323
+ template_see_also ,
1324
+ create_section_header ("Examples" ),
1325
+ dedent (
1326
+ """\
1327
+ >>> ser = pd.Series([0, 1, 5, 2, 8])
1328
+
1329
+ To get an instance of :class:`~pandas.core.window.rolling.Window` we need
1330
+ to pass the parameter `win_type`.
1331
+
1332
+ >>> type(ser.rolling(2, win_type='gaussian'))
1333
+ <class 'pandas.core.window.rolling.Window'>
1334
+
1335
+ In order to use the `SciPy` Gaussian window we need to provide the parameters
1336
+ `M` and `std`. The parameter `M` corresponds to 2 in our example.
1337
+ We pass the second parameter `std` as a parameter of the following method:
1338
+
1339
+ >>> ser.rolling(2, win_type='gaussian').mean(std=3)
1340
+ 0 NaN
1341
+ 1 0.5
1342
+ 2 3.0
1343
+ 3 3.5
1344
+ 4 5.0
1345
+ dtype: float64
1346
+ """
1347
+ ),
1299
1348
window_method = "rolling" ,
1300
1349
aggregation_description = "weighted window mean" ,
1301
1350
agg_method = "mean" ,
@@ -1320,7 +1369,31 @@ def mean(self, numeric_only: bool = False, **kwargs):
1320
1369
create_section_header ("Returns" ),
1321
1370
template_returns ,
1322
1371
create_section_header ("See Also" ),
1323
- template_see_also [:- 1 ],
1372
+ template_see_also ,
1373
+ create_section_header ("Examples" ),
1374
+ dedent (
1375
+ """\
1376
+ >>> ser = pd.Series([0, 1, 5, 2, 8])
1377
+
1378
+ To get an instance of :class:`~pandas.core.window.rolling.Window` we need
1379
+ to pass the parameter `win_type`.
1380
+
1381
+ >>> type(ser.rolling(2, win_type='gaussian'))
1382
+ <class 'pandas.core.window.rolling.Window'>
1383
+
1384
+ In order to use the `SciPy` Gaussian window we need to provide the parameters
1385
+ `M` and `std`. The parameter `M` corresponds to 2 in our example.
1386
+ We pass the second parameter `std` as a parameter of the following method:
1387
+
1388
+ >>> ser.rolling(2, win_type='gaussian').var(std=3)
1389
+ 0 NaN
1390
+ 1 0.5
1391
+ 2 8.0
1392
+ 3 4.5
1393
+ 4 18.0
1394
+ dtype: float64
1395
+ """
1396
+ ),
1324
1397
window_method = "rolling" ,
1325
1398
aggregation_description = "weighted window variance" ,
1326
1399
agg_method = "var" ,
@@ -1338,7 +1411,31 @@ def var(self, ddof: int = 1, numeric_only: bool = False, **kwargs):
1338
1411
create_section_header ("Returns" ),
1339
1412
template_returns ,
1340
1413
create_section_header ("See Also" ),
1341
- template_see_also [:- 1 ],
1414
+ template_see_also ,
1415
+ create_section_header ("Examples" ),
1416
+ dedent (
1417
+ """\
1418
+ >>> ser = pd.Series([0, 1, 5, 2, 8])
1419
+
1420
+ To get an instance of :class:`~pandas.core.window.rolling.Window` we need
1421
+ to pass the parameter `win_type`.
1422
+
1423
+ >>> type(ser.rolling(2, win_type='gaussian'))
1424
+ <class 'pandas.core.window.rolling.Window'>
1425
+
1426
+ In order to use the `SciPy` Gaussian window we need to provide the parameters
1427
+ `M` and `std`. The parameter `M` corresponds to 2 in our example.
1428
+ We pass the second parameter `std` as a parameter of the following method:
1429
+
1430
+ >>> ser.rolling(2, win_type='gaussian').std(std=3)
1431
+ 0 NaN
1432
+ 1 0.707107
1433
+ 2 2.828427
1434
+ 3 2.121320
1435
+ 4 4.242641
1436
+ dtype: float64
1437
+ """
1438
+ ),
1342
1439
window_method = "rolling" ,
1343
1440
aggregation_description = "weighted window standard deviation" ,
1344
1441
agg_method = "std" ,
0 commit comments