@@ -892,8 +892,43 @@ def calc(x):
892
892
893
893
class _Rolling_and_Expanding (_Rolling ):
894
894
895
- _shared_docs ['count' ] = """%(name)s count of number of non-NaN
896
- observations inside provided window."""
895
+ _shared_docs ['count' ] = dedent (r"""
896
+ The %(name)s count of any non-NaN observations inside the window.
897
+
898
+ Returns
899
+ -------
900
+ Series or DataFrame
901
+ Returned object type is determined by the caller of the %(name)s
902
+ calculation.
903
+
904
+ See Also
905
+ --------
906
+ pandas.Series.%(name)s : Calling object with Series data
907
+ pandas.DataFrame.%(name)s : Calling object with DataFrames
908
+ pandas.DataFrame.count : Count of the full DataFrame
909
+
910
+ Examples
911
+ --------
912
+ >>> s = pd.Series([2, 3, np.nan, 10])
913
+ >>> s.rolling(2).count()
914
+ 0 1.0
915
+ 1 2.0
916
+ 2 1.0
917
+ 3 1.0
918
+ dtype: float64
919
+ >>> s.rolling(3).count()
920
+ 0 1.0
921
+ 1 2.0
922
+ 2 2.0
923
+ 3 2.0
924
+ dtype: float64
925
+ >>> s.rolling(4).count()
926
+ 0 1.0
927
+ 1 2.0
928
+ 2 2.0
929
+ 3 3.0
930
+ dtype: float64
931
+ """ )
897
932
898
933
def count (self ):
899
934
@@ -1451,7 +1486,6 @@ def aggregate(self, arg, *args, **kwargs):
1451
1486
agg = aggregate
1452
1487
1453
1488
@Substitution (name = 'rolling' )
1454
- @Appender (_doc_template )
1455
1489
@Appender (_shared_docs ['count' ])
1456
1490
def count (self ):
1457
1491
@@ -1715,7 +1749,6 @@ def aggregate(self, arg, *args, **kwargs):
1715
1749
agg = aggregate
1716
1750
1717
1751
@Substitution (name = 'expanding' )
1718
- @Appender (_doc_template )
1719
1752
@Appender (_shared_docs ['count' ])
1720
1753
def count (self , ** kwargs ):
1721
1754
return super (Expanding , self ).count (** kwargs )
0 commit comments