summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorStefan Otte <stefan.otte@gmail.com>2015-05-10 14:21:26 +0200
committerStefan Otte <stefan.otte@gmail.com>2015-05-10 14:21:26 +0200
commit8284c9cfdf153e6f51cad48b4abdb7519e5e5274 (patch)
tree4a8bcef0badb4852422bafb409870117b36e222f /numpy/core/fromnumeric.py
parent30e3d41b6d11c18e17eb283a61bbe9bbf4bb4d8f (diff)
downloadnumpy-8284c9cfdf153e6f51cad48b4abdb7519e5e5274.tar.gz
DOC: sum/prod & empty array returns neutral elment
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py10
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: