diff options
author | Stefan Otte <stefan.otte@gmail.com> | 2015-05-10 14:21:26 +0200 |
---|---|---|
committer | Stefan Otte <stefan.otte@gmail.com> | 2015-05-10 14:21:26 +0200 |
commit | 8284c9cfdf153e6f51cad48b4abdb7519e5e5274 (patch) | |
tree | 4a8bcef0badb4852422bafb409870117b36e222f /numpy/core/fromnumeric.py | |
parent | 30e3d41b6d11c18e17eb283a61bbe9bbf4bb4d8f (diff) | |
download | numpy-8284c9cfdf153e6f51cad48b4abdb7519e5e5274.tar.gz |
DOC: sum/prod & empty array returns neutral elment
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 549647df2..778cef204 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1770,6 +1770,11 @@ def sum(a, axis=None, dtype=None, out=None, keepdims=False): Arithmetic is modular when using integer types, and no error is raised on overflow. + The sum of an empty array is the neutral element 0: + + >>> np.sum([]) + 0.0 + Examples -------- >>> np.sum([0.5, 1.5]) @@ -2413,6 +2418,11 @@ def prod(a, axis=None, dtype=None, out=None, keepdims=False): >>> np.prod(x) #random 16 + The product of an empty array is the neutral element 1: + + >>> np.prod([]) + 1.0 + Examples -------- By default, calculate the product of all elements: |