Skip to content

Commit 9bef42f

Browse files
committed
Adress review
1 parent 7b1089d commit 9bef42f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

doc/source/whatsnew/v1.2.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ Other enhancements
219219
- Where possible :meth:`RangeIndex.difference` and :meth:`RangeIndex.symmetric_difference` will return :class:`RangeIndex` instead of :class:`Int64Index` (:issue:`36564`)
220220
- Added :meth:`Rolling.sem()` and :meth:`Expanding.sem()` to compute the standard error of mean (:issue:`26476`).
221221
- :meth:`Rolling.var()` and :meth:`Rolling.std()` use Kahan summation and Welfords Method to avoid numerical issues (:issue:`37051`)
222+
- :meth:`DataFrame.corr` and :meth:`DataFrame.cov` use Welfords Method to avoid numerical issues (:issue:`37448`)
222223
- :meth:`DataFrame.plot` now recognizes ``xlabel`` and ``ylabel`` arguments for plots of type ``scatter`` and ``hexbin`` (:issue:`37001`)
223224
- :class:`DataFrame` now supports ``divmod`` operation (:issue:`37165`)
224225
- :meth:`DataFrame.to_parquet` now returns a ``bytes`` object when no ``path`` argument is passed (:issue:`37105`)
@@ -404,7 +405,6 @@ Numeric
404405
- Bug in :class:`IntervalArray` comparisons with :class:`Series` not returning :class:`Series` (:issue:`36908`)
405406
- Bug in :class:`DataFrame` allowing arithmetic operations with list of array-likes with undefined results. Behavior changed to raising ``ValueError`` (:issue:`36702`)
406407
- Bug in :meth:`DataFrame.std`` with ``timedelta64`` dtype and ``skipna=False`` (:issue:`37392`)
407-
- Bug in :meth:`DataFrame.corr` returned inconsistent results for constant columns (:issue:`37448`)
408408

409409
Conversion
410410
^^^^^^^^^^

pandas/_libs/algos.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ def nancorr(const float64_t[:, :] mat, bint cov=False, minp=None):
284284
with nogil:
285285
for xi in range(K):
286286
for yi in range(xi + 1):
287+
# Welford's method for the variance-calculation
288+
# https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
287289
nobs = ssqdmx = ssqdmy = covxy = meanx = meany = 0
288290
for i in range(N):
289291
if mask[i, xi] and mask[i, yi]:

0 commit comments

Comments
 (0)