normsum#
- normsum(arr, total=None)[source]#
Multiply a list or array by some normalizing factor so that its sum is equal to the total. Formerly called “
scaleratio
”.- Parameters:
arr (array) – array (or list) to normalize
total (float) – amount to sum to (default 1)
Example:
normarr = sc.normsum([2,5,3,10], 100) # Scale so sum equals 100; returns [10.0, 25.0, 15.0, 50.0]
Renamed in version 1.0.0.