From 1588ae39ffb51ea916f03510671aab711fdfb568 Mon Sep 17 00:00:00 2001 From: Duke Vijitbenjaronk Date: Tue, 7 Mar 2017 11:11:53 -0600 Subject: BUG: Fix np.average with object array weights Fixes #8696 --- numpy/lib/function_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index c54512c21..0903790bd 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1135,7 +1135,7 @@ def average(a, axis=None, weights=None, returned=False): wgt = wgt.swapaxes(-1, axis) scl = wgt.sum(axis=axis, dtype=result_dtype) - if (scl == 0.0).any(): + if np.any(scl == 0.0): raise ZeroDivisionError( "Weights sum to zero, can't be normalized") -- cgit v1.2.1