Skip to content

Commit 24d2658

Browse files
phoflKevin D Smith
authored and
Kevin D Smith
committed
[DOC]: Add warning about rolling sums with large values (pandas-dev#36433)
1 parent c77e619 commit 24d2658

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/source/user_guide/computation.rst

+9
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,15 @@ see the :ref:`groupby docs <groupby.transform.window_resample>`.
229229

230230
The API for window statistics is quite similar to the way one works with ``GroupBy`` objects, see the documentation :ref:`here <groupby>`.
231231

232+
.. warning::
233+
234+
When using ``rolling()`` and an associated function the results are calculated with rolling sums. As a consequence
235+
when having values differing with magnitude :math:`1/np.finfo(np.double).eps` this results in truncation. It must be
236+
noted, that large values may have an impact on windows, which do not include these values. `Kahan summation
237+
<https://en.wikipedia.org/wiki/Kahan_summation_algorithm>`__ is used
238+
to compute the rolling sums to preserve accuracy as much as possible. The same holds true for ``Rolling.var()`` for
239+
values differing with magnitude :math:`(1/np.finfo(np.double).eps)^{0.5}`.
240+
232241
We work with ``rolling``, ``expanding`` and ``exponentially weighted`` data through the corresponding
233242
objects, :class:`~pandas.core.window.Rolling`, :class:`~pandas.core.window.Expanding` and :class:`~pandas.core.window.ExponentialMovingWindow`.
234243

0 commit comments

Comments
 (0)