Skip to content

Commit

Permalink
Merge pull request numpy#8400 from b-carter/fix_corrcoef_cov_rowvar_p…
Browse files Browse the repository at this point in the history
…aram

Fix `corrcoef` and `cov` rowvar param handling
  • Loading branch information
jaimefrio authored Dec 20, 2016
2 parents 69f9e7a + 3fda48c commit 32ade3a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions numpy/lib/function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 32ade3a

Please sign in to comment.