@@ -926,28 +926,7 @@ def skew(self, **kwargs):
926926
927927 Notes
928928 -----
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.
951930 """ )
952931
953932 def kurt (self , ** kwargs ):
@@ -1269,6 +1248,31 @@ def var(self, ddof=1, *args, **kwargs):
12691248 def skew (self , ** kwargs ):
12701249 return super (Rolling , self ).skew (** kwargs )
12711250
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 )
12721276 @Substitution (name = 'rolling' )
12731277 @Appender (_shared_docs ['kurt' ])
12741278 def kurt (self , ** kwargs ):
@@ -1508,6 +1512,31 @@ def var(self, ddof=1, *args, **kwargs):
15081512 def skew (self , ** kwargs ):
15091513 return super (Expanding , self ).skew (** kwargs )
15101514
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 )
15111540 @Substitution (name = 'expanding' )
15121541 @Appender (_shared_docs ['kurt' ])
15131542 def kurt (self , ** kwargs ):
0 commit comments