python normalize distribution code example
Example 1: normalise list python
>>> a = [2,4,10,6,8,4]
>>> amin, amax = min(a), max(a)
>>> for i, val in enumerate(a):
... a[i] = (val-amin) / (amax-amin)
...
>>> a
[0.0, 0.25, 1.0, 0.5, 0.75, 0.25]
Example 2: normalize data python
>>> from sklearn import preprocessing
>>>
>>> data = [100, 10, 2, 32, 31, 949]
>>>
>>> preprocessing.normalize([data])
array([[0.10467389, 0.01046739, 0.00209348, 0.03349564, 0.03244891,0.99335519]])