summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2010-07-07 04:32:00 +0000
committerCharles Harris <charlesr.harris@gmail.com>2010-07-07 04:32:00 +0000
commit8bb282307481e208f972a72c5745c63e2404cd66 (patch)
tree31d7f1f3ff41423e5d0d90ba20b655072dc414b9 /numpy/lib/function_base.py
parentb1c994b77d851e49a1c62248b09aeaea5645fbdf (diff)
downloadnumpy-8bb282307481e208f972a72c5745c63e2404cd66.tar.gz
ENH: Add ddof keyword to masked versions of cov and corrcoef.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 3f49af5f1..b2ec9bb5a 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -1846,8 +1846,8 @@ def cov(m, y=None, rowvar=1, bias=0, ddof=None):
ddof : int, optional
.. versionadded:: 1.5
If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is
- the number of observations. When defined, ``ddof`` overrides the
- value implied by ``bias``. The default value is ``None``.
+ the number of observations; this overrides the value implied by
+ ``bias``. The default value is ``None``.
Returns
-------
@@ -1893,6 +1893,10 @@ def cov(m, y=None, rowvar=1, bias=0, ddof=None):
11.71
"""
+ # Check inputs
+ if ddof is not None and ddof != int(ddof):
+ raise ValueError("ddof must be integer")
+
X = array(m, ndmin=2, dtype=float)
if X.shape[0] == 1:
rowvar = 1
@@ -1961,8 +1965,8 @@ def corrcoef(x, y=None, rowvar=1, bias=0, ddof=None):
ddof : {None, int}, optional
.. versionadded:: 1.5
If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is
- the number of observations. When defined, ``ddof`` overrides the
- value implied by ``bias``. The default value is ``None``.
+ the number of observations; this overrides the value implied by
+ ``bias``. The default value is ``None``.
Returns
-------