Given a 3x 3 dimensional array
a = numpy.arange(0,27,3).reshape(3,3)
To normalize the rows of a two-dimensional array, I was thinking about
row_sums = a.sum(axis=1)
There must be a better way, right?
Perhaps to clear: by normalization, I mean that the sum of the entries in the row should be one. But I think that it will be clear to most people.
python arrays syntax numpy normalization
Aufwind Jan 18 '12 at 3:12 2012-01-18 03:12
source share