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