How to "squish" a range of numbers to the same spread between 0 and 1 So I have a range of numbers that I need to "squish" into values between 0 and 1 - where lowest value is zero and the highest is 1. I need preserve the ratio.
For instance. If I had these example arrays (all the same ratio between each other):
0, 2000, 8000, 10000
0, 4000, 16000, 20000
0, 200000, 800000, 1000000
I'm hoping to get back a result something like this for each of those individual arrays:
0, 0.2, 0.8, 1
Notice that the ratio between the numbers is preserved.
Is there a built in function somewhere (in numpy?) that does this for me?

Your specifications are not entirely clear to me.
Maybe starting with x and ending with y or z will
do what you want. [Arithmetic and plots using R.]
set.seed(1234)
x = rexp(20, .001)
min(x); max(x)
[1] 6.581957
[1] 3052.458

y = x/max(x)
min(y); max(y)
[1] 0.002156281
[1] 1

z = (x - min(x))/(max(x)- min(x))
min(z); max(z)
[1] 0
[1] 1

par(mfrow=c(1,3))
 hist(x, prob=T, col="skyblue2"); rug(x)
 hist(y, prob=T, col="skyblue2"); rug(y)
 hist(z, prob=T, col="skyblue2"); rug(z)
par(mfrow=c(1,1))


