-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
DOC: update the pandas.DataFrame.cummax docstring #20336
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
Changes from 1 commit
5ccedc2
04f70dd
aec6084
4acf753
1214c93
a88e95a
fe94dad
f73b52f
33e5337
15b38dd
3c30d18
0cb3168
9d46623
5d502cb
e1e190f
aa34ea0
94fc1b3
657feac
77789a8
463eef7
b03c32a
9b05313
1147a0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8487,19 +8487,19 @@ def compound(self, axis=None, skipna=None, level=None): | |
cls.compound = compound | ||
|
||
cls.cummin = _make_cum_function( | ||
cls, 'cummin', name, name2, axis_descr, "cumulative minimum", | ||
cls, 'cummin', name, name2, axis_descr, "minimum", | ||
lambda y, axis: np.minimum.accumulate(y, axis), "min", | ||
np.inf, np.nan, _cummin_examples) | ||
cls.cumsum = _make_cum_function( | ||
cls, 'cumsum', name, name2, axis_descr, "cumulative sum", | ||
cls, 'cumsum', name, name2, axis_descr, "sum", | ||
lambda y, axis: y.cumsum(axis), "sum", 0., | ||
np.nan, _cumsum_examples) | ||
cls.cumprod = _make_cum_function( | ||
cls, 'cumprod', name, name2, axis_descr, "cumulative product", | ||
cls, 'cumprod', name, name2, axis_descr, "product", | ||
lambda y, axis: y.cumprod(axis), "prod", 1., | ||
np.nan, _cumprod_examples) | ||
cls.cummax = _make_cum_function( | ||
cls, 'cummax', name, name2, axis_descr, "cumulative maximum", | ||
cls, 'cummax', name, name2, axis_descr, "maximum", | ||
lambda y, axis: np.maximum.accumulate(y, axis), "max", | ||
-np.inf, np.nan, _cummax_examples) | ||
|
||
|
@@ -8763,9 +8763,10 @@ def _doc_parms(cls): | |
""" | ||
|
||
_cnum_doc = """ | ||
Return %(desc)s over a DataFrame or Series axis. | ||
Return cumulative %(desc)s over a DataFrame or Series axis. | ||
|
||
Returns a DataFrame or Series of the same size containing the %(desc)s. | ||
Returns a DataFrame or Series of the same size containing the cumulative | ||
%(desc)s. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -8786,8 +8787,8 @@ def _doc_parms(cls): | |
-------- | ||
pandas.core.window.Expanding.%(accum_func_name)s : Similar functionality | ||
but ignores ``NaN`` values. | ||
Series.%(outname)s : Return %(desc)s over Series axis. | ||
%(name2)s.%(accum_func_name)s : Return the %(accum_func_name)s over | ||
Series.%(outname)s : Return cumulative %(desc)s over Series axis. | ||
%(name2)s.%(accum_func_name)s : Return the %(desc)s over | ||
%(name2)s axis. | ||
DataFrame.cummax : Return cumulative maximum over DataFrame axis. | ||
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. @datapythonista @jorisvandenbossche Is it a good idea to also add: 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. Yes, that might be a good idea, if you can automatically make it link in 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. This also 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. If I implement these changes, we won't get a reference to any corresponding I agree that we don't really need them because we have examples of both Just out of curiosity, is there a simple way to determine whether a 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. The thing is that the docstring for both Series and DataFrame (of the same method) will be exactly the same (apart from some of the links here in see also). So linking to the same method but on the other object, is not that important I think, as the other one does not give you more information
Yes, the |
||
%(name2)s.cummin : Return cumulative minimum over %(name2)s axis. | ||
|
@@ -8906,7 +8907,7 @@ def _doc_parms(cls): | |
1 3.0 NaN | ||
2 1.0 0.0 | ||
|
||
By default, iterates over rows and finds the minimum | ||
By default, iterates over rows and finds the sum | ||
in each column. This is equivalent to ``axis=None`` or ``axis='index'``. | ||
|
||
>>> df.cumsum() | ||
|
@@ -8915,7 +8916,7 @@ def _doc_parms(cls): | |
1 5.0 NaN | ||
2 6.0 1.0 | ||
|
||
To iterate over columns and find the minimum in each row, | ||
To iterate over columns and find the sum in each row, | ||
use ``axis=1`` | ||
|
||
>>> df.cumsum(axis=1) | ||
|
@@ -8971,7 +8972,7 @@ def _doc_parms(cls): | |
1 3.0 NaN | ||
2 1.0 0.0 | ||
|
||
By default, iterates over rows and finds the minimum | ||
By default, iterates over rows and finds the product | ||
in each column. This is equivalent to ``axis=None`` or ``axis='index'``. | ||
|
||
>>> df.cumprod() | ||
|
@@ -8980,7 +8981,7 @@ def _doc_parms(cls): | |
1 6.0 NaN | ||
2 6.0 0.0 | ||
|
||
To iterate over columns and find the minimum in each row, | ||
To iterate over columns and find the product in each row, | ||
use ``axis=1`` | ||
|
||
>>> df.cumprod(axis=1) | ||
|
@@ -9036,7 +9037,7 @@ def _doc_parms(cls): | |
1 3.0 NaN | ||
2 1.0 0.0 | ||
|
||
By default, iterates over rows and finds the minimum | ||
By default, iterates over rows and finds the maximum | ||
in each column. This is equivalent to ``axis=None`` or ``axis='index'``. | ||
|
||
>>> df.cummax() | ||
|
@@ -9045,7 +9046,7 @@ def _doc_parms(cls): | |
1 3.0 NaN | ||
2 3.0 1.0 | ||
|
||
To iterate over columns and find the minimum in each row, | ||
To iterate over columns and find the maximum in each row, | ||
use ``axis=1`` | ||
|
||
>>> df.cummax(axis=1) | ||
|
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 think this one can be left out, as it will already be included in one of the 4 last ones.