diff options
author | Matthew Brett <matthew.brett@gmail.com> | 2015-03-15 11:34:58 -0700 |
---|---|---|
committer | Matthew Brett <matthew.brett@gmail.com> | 2015-03-15 11:45:18 -0700 |
commit | 594c64cedc3e521bc223fb90f29f22b034de3839 (patch) | |
tree | 3b1791109f3a70c0cc68855fe4f5bbe37477e831 /numpy/ma/tests/test_regression.py | |
parent | 4b4d8510739c9ea7a80391e2656d84a3c5e4a9c3 (diff) | |
download | numpy-594c64cedc3e521bc223fb90f29f22b034de3839.tar.gz |
ENH: deprecate bias and ddof arguments to corrcoef
The bias and ddof arguments had no effect on the calculation of the
correlation coefficient because the value cancels in the calculation.
Deprecate these arguments to np.corrcoef and np.ma.corrcoef.
Diffstat (limited to 'numpy/ma/tests/test_regression.py')
-rw-r--r-- | numpy/ma/tests/test_regression.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/numpy/ma/tests/test_regression.py b/numpy/ma/tests/test_regression.py index 7b32199ea..dba74d357 100644 --- a/numpy/ma/tests/test_regression.py +++ b/numpy/ma/tests/test_regression.py @@ -1,7 +1,10 @@ from __future__ import division, absolute_import, print_function +import warnings + import numpy as np -from numpy.testing import * +from numpy.testing import (assert_, TestCase, assert_array_equal, + assert_allclose, run_module_suite) from numpy.compat import sixu rlevel = 1 @@ -66,10 +69,12 @@ class TestRegression(TestCase): # See gh-3336 x = np.ma.masked_equal([1, 2, 3, 4, 5], 4) y = np.array([2, 2.5, 3.1, 3, 5]) - r0 = np.ma.corrcoef(x, y, ddof=0) - r1 = np.ma.corrcoef(x, y, ddof=1) - # ddof should not have an effect (it gets cancelled out) - assert_allclose(r0.data, r1.data) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + r0 = np.ma.corrcoef(x, y, ddof=0) + r1 = np.ma.corrcoef(x, y, ddof=1) + # ddof should not have an effect (it gets cancelled out) + assert_allclose(r0.data, r1.data) if __name__ == "__main__": run_module_suite() |