Sum of NumPy Array in Python (3 Examples) | np.sum() Function of NumPy Library | Adding Rows/Columns

Veröffentlicht am: 01 Juli 2022
auf dem Kanal: Statistics Globe
979
21

How to apply the np.sum function in the Python programming language. More details: https://statisticsglobe.com/sum-numpy...
Python code of this video:

import numpy as np # Load NumPy library

my_array = np.array([[1, 2, 3], [4, 5, 6]]) # Create example array
print(my_array) # Print example array
[[1 2 3]
[4 5 6]]

print(np.sum(my_array)) # Get sum of all array values
21

print(np.sum(my_array, axis = 0)) # Get sum of array columns
[5 7 9]

print(np.sum(my_array, axis = 1)) # Get sum of array rows
[ 6 15]

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – Group for Discussions & Questions:   / statisticsglobe  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – Group for Discussions & Questions:   / 12555223  
Twitter:   / joachimschork  

Music by bensound.com


Auf dieser Seite können Sie das Online-Video Sum of NumPy Array in Python (3 Examples) | np.sum() Function of NumPy Library | Adding Rows/Columns mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Statistics Globe 01 Juli 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 979 Mal angesehen und es wurde von 21 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!