I have a range of r=data which is both positive and negative. I wanted to normalize it to the [-1,1] range.
I used
apply(lambda x: -1 + (2*((x - x.min()) / (x.max() - x.min()))))
which normalised the data from -1 to 1, but in my data 0 is significant and thus I would like to needs to be preserved it.
How can I accomplish it ?