🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.sum.html
numpy.sum — NumPy v2.3 Manual
Elements to include in the sum. See reduce for details. ... An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned.
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-sum-in-python
numpy.sum() in Python - GeeksforGeeks
January 30, 2026 - Example 2: This example calculates the sum of a 2D array and shows how using different data types changes the output. ... import numpy as np arr = np.array([ [14, 17, 12, 33, 44], [15, 6, 27, 8, 19], [23, 2, 54, 1, 4] ]) print(np.sum(arr)) print(np.sum(arr, dtype=np.uint8)) print(np.sum(arr, dtype=np.float32))
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.sum.html
numpy.sum — NumPy v2.5 Manual
Elements to include in the sum. See reduce for details. ... An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned.
🌐
DataCamp
datacamp.com › doc › numpy › sum
NumPy sum()
NumPy's `sum()` function is a powerful tool for array computation and analysis, allowing users to efficiently compute the sum of array elements along a specified axis.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.ndarray.sum.html
numpy.ndarray.sum — NumPy v2.2 Manual
Return the sum of the array elements over the given axis. Refer to numpy.sum for full documentation.
🌐
Vultr Docs
docs.vultr.com › python › third party › numpy › sum()
Python Numpy sum() - Calculate Array Sum
January 1, 2025 - Start by importing the numpy module. Create an array of numbers. Apply the sum() function to compute the total sum.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.sum.html
numpy.sum — NumPy v2.1 Manual
Elements to include in the sum. See reduce for details. New in version 1.17.0. ... An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.ma.sum.html
numpy.ma.sum — NumPy v2.1 Manual
numpy.sum · equivalent function · Examples · >>> import numpy as np >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) >>> x masked_array( data=[[1, --, 3], [--, 5, --], [7, --, 9]], mask=[[False, True, False], [ True, False, True], [False, True, False]], fill_value=999999) >>> x.sum() 25 >>> x.sum(axis=1) masked_array(data=[4, 5, 16], mask=[False, False, False], fill_value=999999) >>> x.sum(axis=0) masked_array(data=[8, 5, 12], mask=[False, False, False], fill_value=999999) >>> print(type(x.sum(axis=0, dtype=np.int64)[0])) <class 'numpy.int64'> On this page
Find elsewhere
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.ndarray.sum.html
numpy.ndarray.sum — NumPy v2.5 Manual
ndarray.sum(axis=None, dtype=None, out=None, *, keepdims=<no value>, initial=<no value>, where=<no value>)#
🌐
Python Tutorial
pythontutorial.net › home › python numpy › numpy sum()
NumPy sum(): Calculate the Sum of Elements in an Array
August 16, 2022 - The numpy sum() function is an aggregate function that takes an array and returns the sum of all elements.
🌐
DigitalOcean
digitalocean.com › community › tutorials › numpy-sum-in-python
numpy.sum() in Python | DigitalOcean
Technical tutorials, Q&A, events — This is an inclusive place where developers can find or lend support and discover new ways to contribute to the community.
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.ndarray.sum.html
numpy.ndarray.sum — NumPy v2.0 Manual
Return the sum of the array elements over the given axis. Refer to numpy.sum for full documentation.
🌐
Codecademy
codecademy.com › docs › python:numpy › ndarray › .sum()
Python:NumPy | ndarray | .sum() | Codecademy
October 31, 2025 - The .sum() method returns the sum of array elements over a given axis.
🌐
Programiz
programiz.com › python-programming › numpy › methods › sum
NumPy sum() (With Examples)
NumPy median() The sum() function is used to calculate the sum of array elements along a specified axis or across all axes. import numpy as np array1 = np.array([1, 2, 3, 4, 5]) # use sum() to calculate sum of array1 elements result = np.sum(array1) print(result) # Output : 15 ·
🌐
SciPy
docs.scipy.org › doc › numpy-1.10.0 › reference › generated › numpy.sum.html
numpy.sum — NumPy v1.10 Manual
numpy.sum(a, axis=None, dtype=None, out=None, keepdims=False)[source]¶ · Sum of array elements over a given axis. See also · ndarray.sum · Equivalent method. cumsum · Cumulative sum of array elements. trapz · Integration of array values using the composite trapezoidal rule.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.ndarray.sum.html
numpy.ndarray.sum — NumPy v2.1 Manual
Return the sum of the array elements over the given axis. Refer to numpy.sum for full documentation.
🌐
Sharp Sight
sharpsight.ai › blog › numpy-sum
How to Use the Numpy Sum Function - Sharp Sight
February 6, 2024 - It is essentially the array of elements that you want to sum up. Typically, the argument to this parameter will be a NumPy array (i.e., an ndarray object).
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.ndarray.sum.html
numpy.ndarray.sum — NumPy v2.6.dev0 Manual
ndarray.sum(axis=None, dtype=None, out=None, *, keepdims=<no value>, initial=<no value>, where=<no value>)#