From 07ed95fe7749820558abbf08b51f74bb3f014984 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 16 Mar 2008 17:08:32 +0000 Subject: Change ValueError to TypeError in average --- numpy/lib/function_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index c85aad451..07a69e762 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -368,7 +368,7 @@ def average(a, axis=None, weights=None, returned=False): ZeroDivisionError Results when all weights are zero.if appropriate. The version in MA does not, it returns masked values. - ValueError + TypeError Results when both an axis and weights are specified and the weights are not an 1D array. @@ -399,7 +399,7 @@ def average(a, axis=None, weights=None, returned=False): wgt = np.array(weights, dtype=a.dtype, copy=0) scl = wgt.sum() if axis is not None and wgt.ndim != 1 : - raise ValueError, 'Weights must be 1D when axis is specified' + raise TypeError, 'Weights must be 1D when axis is specified' if scl == 0.0: raise ZeroDivisionError, "Weights sum to zero, can't be normalized" -- cgit v1.2.1