@@ -924,27 +924,7 @@ def skew(self, **kwargs):
924
924
925
925
Notes
926
926
-----
927
- A minimum of 4 periods is required for the rolling calculation.
928
-
929
- Examples
930
- --------
931
- The below example will show a rolling calculation with a window size of
932
- four matching the equivalent function call using `scipy.stats`.
933
-
934
- >>> arr = [1, 2, 3, 4, 999]
935
- >>> import scipy.stats
936
- >>> print("{0:.6f}".format(scipy.stats.kurtosis(arr[:-1], bias=False)))
937
- -1.200000
938
- >>> print("{0:.6f}".format(scipy.stats.kurtosis(arr[1:], bias=False)))
939
- 3.999946
940
- >>> s = pd.Series(arr)
941
- >>> s.rolling(4).kurt()
942
- 0 NaN
943
- 1 NaN
944
- 2 NaN
945
- 3 -1.200000
946
- 4 3.999946
947
- dtype: float64
927
+ A minimum of 4 periods is required for the %(name)s calculation.
948
928
""" )
949
929
950
930
def kurt (self , ** kwargs ):
@@ -1266,6 +1246,30 @@ def var(self, ddof=1, *args, **kwargs):
1266
1246
def skew (self , ** kwargs ):
1267
1247
return super (Rolling , self ).skew (** kwargs )
1268
1248
1249
+ _agg_doc = dedent ("""
1250
+ Examples
1251
+ --------
1252
+
1253
+ The example below will show a rolling calculation with a window size of
1254
+ four matching the equivalent function call using `scipy.stats`.
1255
+
1256
+ >>> arr = [1, 2, 3, 4, 999]
1257
+ >>> import scipy.stats
1258
+ >>> print("{0:.6f}".format(scipy.stats.kurtosis(arr[:-1], bias=False)))
1259
+ -1.200000
1260
+ >>> print("{0:.6f}".format(scipy.stats.kurtosis(arr[1:], bias=False)))
1261
+ 3.999946
1262
+ >>> s = pd.Series(arr)
1263
+ >>> s.rolling(4).kurt()
1264
+ 0 NaN
1265
+ 1 NaN
1266
+ 2 NaN
1267
+ 3 -1.200000
1268
+ 4 3.999946
1269
+ dtype: float64
1270
+ """ )
1271
+
1272
+ @Appender (_agg_doc )
1269
1273
@Substitution (name = 'rolling' )
1270
1274
@Appender (_shared_docs ['kurt' ])
1271
1275
def kurt (self , ** kwargs ):
@@ -1505,6 +1509,30 @@ def var(self, ddof=1, *args, **kwargs):
1505
1509
def skew (self , ** kwargs ):
1506
1510
return super (Expanding , self ).skew (** kwargs )
1507
1511
1512
+ _agg_doc = dedent ("""
1513
+ Examples
1514
+ --------
1515
+
1516
+ The example below will show an expanding calculation with a window size of
1517
+ four matching the equivalent function call using `scipy.stats`.
1518
+
1519
+ >>> arr = [1, 2, 3, 4, 999]
1520
+ >>> import scipy.stats
1521
+ >>> print("{0:.6f}".format(scipy.stats.kurtosis(arr[:-1], bias=False)))
1522
+ -1.200000
1523
+ >>> print("{0:.6f}".format(scipy.stats.kurtosis(arr, bias=False)))
1524
+ 4.999874
1525
+ >>> s = pd.Series(arr)
1526
+ >>> s.expanding(4).kurt()
1527
+ 0 NaN
1528
+ 1 NaN
1529
+ 2 NaN
1530
+ 3 -1.200000
1531
+ 4 4.999874
1532
+ dtype: float64
1533
+ """ )
1534
+
1535
+ @Appender (_agg_doc )
1508
1536
@Substitution (name = 'expanding' )
1509
1537
@Appender (_shared_docs ['kurt' ])
1510
1538
def kurt (self , ** kwargs ):
0 commit comments