-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Improved links between expanding and cum* (GH12651) #14098
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3296,12 +3296,16 @@ def fillna(self, value=None, method=None, axis=None, inplace=False, | |
return self._constructor(new_data).__finalize__(self) | ||
|
||
def ffill(self, axis=None, inplace=False, limit=None, downcast=None): | ||
"""Synonym for NDFrame.fillna(method='ffill')""" | ||
""" | ||
Synonym for :meth:`DataFrame.fillna(method='ffill') <DataFrame.fillna>` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a |
||
""" | ||
return self.fillna(method='ffill', axis=axis, inplace=inplace, | ||
limit=limit, downcast=downcast) | ||
|
||
def bfill(self, axis=None, inplace=False, limit=None, downcast=None): | ||
"""Synonym for NDFrame.fillna(method='bfill')""" | ||
""" | ||
Synonym for :meth:`DataFrame.fillna(method='bfill') <DataFrame.fillna>` | ||
""" | ||
return self.fillna(method='bfill', axis=axis, inplace=inplace, | ||
limit=limit, downcast=downcast) | ||
|
||
|
@@ -5359,16 +5363,18 @@ def compound(self, axis=None, skipna=None, level=None): | |
|
||
cls.cummin = _make_cum_function( | ||
cls, 'cummin', name, name2, axis_descr, "cumulative minimum", | ||
lambda y, axis: np.minimum.accumulate(y, axis), np.inf, np.nan) | ||
lambda y, axis: np.minimum.accumulate(y, axis), "min", | ||
np.inf, np.nan) | ||
cls.cumsum = _make_cum_function( | ||
cls, 'cumsum', name, name2, axis_descr, "cumulative sum", | ||
lambda y, axis: y.cumsum(axis), 0., np.nan) | ||
lambda y, axis: y.cumsum(axis), "sum", 0., np.nan) | ||
cls.cumprod = _make_cum_function( | ||
cls, 'cumprod', name, name2, axis_descr, "cumulative product", | ||
lambda y, axis: y.cumprod(axis), 1., np.nan) | ||
lambda y, axis: y.cumprod(axis), "prod", 1., np.nan) | ||
cls.cummax = _make_cum_function( | ||
cls, 'cummax', name, name2, axis_descr, "cumulative max", | ||
lambda y, axis: np.maximum.accumulate(y, axis), -np.inf, np.nan) | ||
lambda y, axis: np.maximum.accumulate(y, axis), "max", | ||
-np.inf, np.nan) | ||
|
||
cls.sum = _make_stat_function( | ||
cls, 'sum', name, name2, axis_descr, | ||
|
@@ -5556,7 +5562,15 @@ def _doc_parms(cls): | |
|
||
Returns | ||
------- | ||
%(outname)s : %(name1)s\n""" | ||
%(outname)s : %(name1)s\n | ||
|
||
|
||
See also | ||
-------- | ||
pandas.core.window.Expanding.%(accum_func_name)s : Similar functionality | ||
but ignores ``NaN`` values. | ||
|
||
""" | ||
|
||
|
||
def _make_stat_function(cls, name, name1, name2, axis_descr, desc, f): | ||
|
@@ -5599,10 +5613,10 @@ def stat_func(self, axis=None, skipna=None, level=None, ddof=1, | |
return set_function_name(stat_func, name, cls) | ||
|
||
|
||
def _make_cum_function(cls, name, name1, name2, axis_descr, desc, accum_func, | ||
mask_a, mask_b): | ||
def _make_cum_function(cls, name, name1, name2, axis_descr, desc, | ||
accum_func, accum_func_name, mask_a, mask_b): | ||
@Substitution(outname=name, desc=desc, name1=name1, name2=name2, | ||
axis_descr=axis_descr) | ||
axis_descr=axis_descr, accum_func_name=accum_func_name) | ||
@Appender("Return {0} over requested axis.".format(desc) + | ||
_cnum_doc) | ||
def cum_func(self, axis=None, skipna=True, *args, **kwargs): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would specify
min_periods
explicty here, as that is what we are highliting. (and maybe change the example a bit somin_periods=1
andmin_periods=2
) show different results.you may need to make this a sub-section rather than a note (as its getting long)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this in 30025d8