Reputation: 7659
I am trying to sum the values of a nD array along a particular axis to effectively collapse it into a 1D array. I have been looking through the docs but haven't been able to find the right function. I will try to explain my question better with some code:
In [46]: g
Out[46]:
array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])
The output I need is:
array([5,10,15])
My actual data is a 7 MB file so I don't really want to use a for loop.
Thank you for your help
Upvotes: 2
Views: 468