summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime <jaime.frio@gmail.com>2016-12-20 09:14:54 +0100
committerGitHub <noreply@github.com>2016-12-20 09:14:54 +0100
commit32ade3a75de147027c477a08d427d6f64603edfd (patch)
treea0f0a4496d8a709d0ac2cc15cf1be8b34c30117f
parent69f9e7ad83a4b580d08ebded0cc3468d417766cd (diff)
parent3fda48c4ab78f984e0a4bb5e6556052e90583b86 (diff)
downloadnumpy-32ade3a75de147027c477a08d427d6f64603edfd.tar.gz
Merge pull request #8400 from b-carter/fix_corrcoef_cov_rowvar_param
Fix `corrcoef` and `cov` rowvar param handling
-rw-r--r--numpy/lib/function_base.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 172e9a322..d01430c8c 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -2842,13 +2842,13 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,
dtype = np.result_type(m, y, np.float64)
X = array(m, ndmin=2, dtype=dtype)
- if rowvar == 0 and X.shape[0] != 1:
+ if not rowvar and X.shape[0] != 1:
X = X.T
if X.shape[0] == 0:
return np.array([]).reshape(0, 0)
if y is not None:
y = array(y, copy=False, ndmin=2, dtype=dtype)
- if rowvar == 0 and y.shape[0] != 1:
+ if not rowvar and y.shape[0] != 1:
y = y.T
X = np.vstack((X, y))
@@ -2918,7 +2918,7 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,
return c.squeeze()
-def corrcoef(x, y=None, rowvar=1, bias=np._NoValue, ddof=np._NoValue):
+def corrcoef(x, y=None, rowvar=True, bias=np._NoValue, ddof=np._NoValue):
"""
Return Pearson product-moment correlation coefficients.
@@ -2939,8 +2939,8 @@ def corrcoef(x, y=None, rowvar=1, bias=np._NoValue, ddof=np._NoValue):
y : array_like, optional
An additional set of variables and observations. `y` has the same
shape as `x`.
- rowvar : int, optional
- If `rowvar` is non-zero (default), then each row represents a
+ rowvar : bool, optional
+ If `rowvar` is True (default), then each row represents a
variable, with observations in the columns. Otherwise, the relationship
is transposed: each column represents a variable, while the rows
contain observations.