diff options
author | Hameer Abbasi <einstein.edison@gmail.com> | 2019-10-08 02:22:41 +0500 |
---|---|---|
committer | Hameer Abbasi <einstein.edison@gmail.com> | 2019-10-08 02:22:41 +0500 |
commit | 2246f68b1af3f27bce9cbee3a49aa10e1dd7cb80 (patch) | |
tree | 6eaa55f3167512cc044304512be5ac87f215d9ff /numpy/lib/function_base.py | |
parent | 750a59e9310ff1226ff2912fc29a815c2ce07ed2 (diff) | |
parent | d2c57616d369fdb5b4ea22b77d314785b1a0508e (diff) | |
download | numpy-2246f68b1af3f27bce9cbee3a49aa10e1dd7cb80.tar.gz |
Merge branch 'uarray' into uarray-me
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 9d380e67d..21532838b 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -316,14 +316,17 @@ def average(a, axis=None, weights=None, returned=False): The weights array can either be 1-D (in which case its length must be the size of `a` along the given axis) or of the same shape as `a`. If `weights=None`, then all data in `a` are assumed to have a - weight equal to one. + weight equal to one. The 1-D calculation is:: + + avg = sum(a * weights) / sum(weights) + + The only constraint on `weights` is that `sum(weights)` must not be 0. returned : bool, optional Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) is returned, otherwise only the average is returned. If `weights=None`, `sum_of_weights` is equivalent to the number of elements over which the average is taken. - Returns ------- retval, [sum_of_weights] : array_type or double |