I'm trying to normalize an array of values, but when I put it in the numpy array, it automatically converts the values to integers. Code is below:
import numpy as np
data = np.array([[1,2],[3,1],[3,5],[4,6],[3,4]])
s = np.std(data[:,0])
m = np.mean(data[:,0])
temp = (data[:,0] - m)
temp /= s
print(temp)
data[:,0] = temp
print(data)
and the result is this:
[-0.86266219 -1.40182605 0.75482941 1.29399328 0.21566555]
[[ 1 0]
[ 3 -1]
[ 3 0]
[ 4 1]
[ 3 0]]
Why does it automatically convert to integer when I put it into numpy? How do I fix this?