I have an existing python array instantiated with zeros. How do I iterate through and change the values?
I can't iterate through and change elements of a Python array?
num_list = [1,2,3,3,4,5,]
mu = np.mean(num_list)
sigma = np.std(num_list)
std_array = np.zeros(len(num_list))
for i in std_array:
temp_num = ((i-mu)/sigma)
std_array[i]=temp_num
This the error:
only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices
[0. 0. 0. 0. 0. 0.]