I have this ndarray (not matrix):
mx = np.array([[10,25,33],[3,1,5],[50,50,52]])
[[10 25 33]
[ 3 1 5]
[50 50 52]]
and I want to get a ndarray of shares by dividing every element by the sum of the column. So the result of this operation:
[[10/63 25/76 33/90]
[ 3/63 1/76 5/90]
[50/63 50/76 52/90]]
I can do
np.true_divide(mx,mx.sum(axis=0))
Are ther some build-in functions to calculate shares or stuff like that?
mx / mx.sum(axis=0). If that does the wrong division, usefrom __future__ import divisionat the top of your file