Skip to content

Commit

Permalink
DOC: update the pandas.core.window.x.mean docstring (#20265)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymetz authored and jorisvandenbossche committed Mar 17, 2018
1 parent eb1f51f commit ad50b1d
Showing 1 changed file with 42 additions and 4 deletions.
46 changes: 42 additions & 4 deletions pandas/core/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,48 @@ def aggregate(self, arg, *args, **kwargs):
""")

_shared_docs['mean'] = dedent("""
%(name)s mean""")
Calculate the %(name)s mean of the values.
Parameters
----------
*args
Under Review.
**kwargs
Under Review.
Returns
-------
Series or DataFrame
Returned object type is determined by the caller of the %(name)s
calculation.
See Also
--------
Series.%(name)s : Calling object with Series data
DataFrame.%(name)s : Calling object with DataFrames
Series.mean : Equivalent method for Series
DataFrame.mean : Equivalent method for DataFrame
Examples
--------
The below examples will show rolling mean calculations with window sizes of
two and three, respectively.
>>> s = pd.Series([1, 2, 3, 4])
>>> s.rolling(2).mean()
0 NaN
1 1.5
2 2.5
3 3.5
dtype: float64
>>> s.rolling(3).mean()
0 NaN
1 NaN
2 2.0
3 3.0
dtype: float64
""")


class Window(_Window):
Expand Down Expand Up @@ -718,7 +759,6 @@ def sum(self, *args, **kwargs):
return self._apply_window(mean=False, **kwargs)

@Substitution(name='window')
@Appender(_doc_template)
@Appender(_shared_docs['mean'])
def mean(self, *args, **kwargs):
nv.validate_window_func('mean', args, kwargs)
Expand Down Expand Up @@ -1447,7 +1487,6 @@ def min(self, *args, **kwargs):
return super(Rolling, self).min(*args, **kwargs)

@Substitution(name='rolling')
@Appender(_doc_template)
@Appender(_shared_docs['mean'])
def mean(self, *args, **kwargs):
nv.validate_rolling_func('mean', args, kwargs)
Expand Down Expand Up @@ -1707,7 +1746,6 @@ def min(self, *args, **kwargs):
return super(Expanding, self).min(*args, **kwargs)

@Substitution(name='expanding')
@Appender(_doc_template)
@Appender(_shared_docs['mean'])
def mean(self, *args, **kwargs):
nv.validate_expanding_func('mean', args, kwargs)
Expand Down

0 comments on commit ad50b1d

Please sign in to comment.