Skip to content

Commit 4427e28

Browse files
DOC: Improved links between expanding and cum* (pandas-dev#12651)
Fixed the PEP8 incompatible line lengths.
1 parent 8466669 commit 4427e28

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

doc/source/computation.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -702,10 +702,10 @@ all accept are:
702702

703703
The output of the ``.rolling`` and ``.expanding`` methods do not return a
704704
``NaN`` if there are at least ``min_periods`` non-null values in the current
705-
window. This differs from :meth:`~DataFrame.cumsum`, :meth:`~DataFrame.cumprod`,
706-
:meth:`~DataFrame.cummax`, and :meth:`~DataFrame.cummin`,
707-
which return ``NaN`` in the output wherever a ``NaN``
708-
is encountered in the input.
705+
window. This differs from :meth:`~DataFrame.cumsum`,
706+
:meth:`~DataFrame.cumprod`, :meth:`~DataFrame.cummax`,
707+
and :meth:`~DataFrame.cummin`, which return ``NaN`` in the output wherever
708+
a ``NaN`` is encountered in the input.
709709

710710
Please see the example below. In order to match the output of ``cumsum``
711711
with ``expanding``, use :meth:`~DataFrame.fillna`.

pandas/core/generic.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -5363,7 +5363,8 @@ def compound(self, axis=None, skipna=None, level=None):
53635363

53645364
cls.cummin = _make_cum_function(
53655365
cls, 'cummin', name, name2, axis_descr, "cumulative minimum",
5366-
lambda y, axis: np.minimum.accumulate(y, axis), "min", np.inf, np.nan)
5366+
lambda y, axis: np.minimum.accumulate(y, axis), "min",
5367+
np.inf, np.nan)
53675368
cls.cumsum = _make_cum_function(
53685369
cls, 'cumsum', name, name2, axis_descr, "cumulative sum",
53695370
lambda y, axis: y.cumsum(axis), "sum", 0., np.nan)
@@ -5372,7 +5373,8 @@ def compound(self, axis=None, skipna=None, level=None):
53725373
lambda y, axis: y.cumprod(axis), "prod", 1., np.nan)
53735374
cls.cummax = _make_cum_function(
53745375
cls, 'cummax', name, name2, axis_descr, "cumulative max",
5375-
lambda y, axis: np.maximum.accumulate(y, axis), "max", -np.inf, np.nan)
5376+
lambda y, axis: np.maximum.accumulate(y, axis), "max",
5377+
-np.inf, np.nan)
53765378

53775379
cls.sum = _make_stat_function(
53785380
cls, 'sum', name, name2, axis_descr,

0 commit comments

Comments
 (0)