diff options
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: |