diff options
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index edad0ae26..37bcaab55 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -674,7 +674,10 @@ def corrcoef(x, y=None): """The correlation coefficients """ c = cov(x, y) - d = diag(c) + try: + d = diag(c) + except ValueError: # scalar covariance + return 1 return c/sqrt(multiply.outer(d,d)) def blackman(M): |