👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.
In Python, how to sum columns of a NumPy array?
To sum the columns of a NumPy array, the best option is to use the
numpy.sum() method by specifying the
>>> import numpy as np
>>> a = np.array([[1, 2], [3, 4], [5, 6]])
array([ 9, 12])