Sum of each column
Write a NumPy program to calculate the sum of each column.
[[5, 3], [7, 4]]
[12 7]
Approach
sum(axis=0).
Solution
import numpy as npprint(np.array([[5, 3], [7, 4]]).sum(axis=0))[12 7]
Learn the concept
New to this topic? Read the lesson, then come back.