Random Gaussian Noise

Hey,
I have this waveform predicted:

Why when I add this code:

a = np.random.normal(mean, stdv, error_noise.shape[0])
test_predict[0] = test_predict[0] + a[0]

The output result is the following:

a will a vector of length error_noise.shape[0] which will be the same length as test_predict

When you do,

test_predict[0] = test_predict[0] + a[0]

You’re taking the first element of the test_predict vector and adding the first element of the a vector which is why only the very first element changes. If you want to add all of a to test_predict just do,

test_predict = test_predcit + a