I have a Python array, like so:
[[1,2,3], [1,2,3]]
I can add the row by doing sum(array[i]), how can I sum a column, using a
sum(array[i])
You can use numpy:
import numpy as np a = np.array([[1,2,3],[1,2,3]]) a.sum(0)