@@ -924,27 +924,7 @@ def skew(self, **kwargs):
924924
925925 Notes
926926 -----
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.
948928 """ )
949929
950930 def kurt (self , ** kwargs ):
@@ -1266,6 +1246,30 @@ def var(self, ddof=1, *args, **kwargs):
12661246 def skew (self , ** kwargs ):
12671247 return super (Rolling , self ).skew (** kwargs )
12681248
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 )
12691273 @Substitution (name = 'rolling' )
12701274 @Appender (_shared_docs ['kurt' ])
12711275 def kurt (self , ** kwargs ):
@@ -1505,6 +1509,30 @@ def var(self, ddof=1, *args, **kwargs):
15051509 def skew (self , ** kwargs ):
15061510 return super (Expanding , self ).skew (** kwargs )
15071511
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 )
15081536 @Substitution (name = 'expanding' )
15091537 @Appender (_shared_docs ['kurt' ])
15101538 def kurt (self , ** kwargs ):
0 commit comments