Skip to content

DOC: update the window.Rolling.min docstring #20263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions pandas/core/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,48 @@ def max(self, *args, **kwargs):
return self._apply('roll_max', 'max', **kwargs)

_shared_docs['min'] = dedent("""
%(name)s minimum
""")
Calculate the %(name)s minimum.

Parameters
----------
**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 a Series
DataFrame.%(name)s : Calling object with a DataFrame
Series.min : Similar method for Series
DataFrame.min : Similar method for DataFrame

Examples
--------
The below example will show a rolling calculation
with a window size of 3.

>>> s = pd.Series([4,3,5,2,6])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces after comma for PEP8

>>> s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor here is simple enough that you don't need to explicitly print

0 4
1 3
2 5
3 2
4 6
dtype: int64
>>> s.rolling(3).min()
0 NaN
1 NaN
2 3.0
3 2.0
4 2.0
dtype: float64
""")

def min(self, *args, **kwargs):
nv.validate_window_func('min', args, kwargs)
return self._apply('roll_min', 'min', **kwargs)
Expand Down Expand Up @@ -1230,7 +1269,6 @@ def max(self, *args, **kwargs):
return super(Rolling, self).max(*args, **kwargs)

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

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