I am trying to add zeros to an array at desired indices.
newerror = []
for i in range(40):
temp = []
for j in range(20):
output = numpy.zeros((196)).astype(numpy.float64) # 196*1
x=index2[i][j].astype(int) # 40*20*49
# filling 49 elements into 196 elements
# at desired indices
y=error[i][j] # 40*20*49
for (ind, rep) in zip(x, y):
output[ind] = rep
temp.append(output)
newerror.append(temp) #40*20*196
I have achieved it using the above code. For each array of inputs: the zeros in output array are replaced with input values at the the desired index.
but my result looks like this: with a random array showing up in scientific notation while there is no requirement.
(piece of ouput;Total output size:40*20*196)
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
7.69098301e-02 0.00000000e+00 0.00000000e+00 1.51987125e-01
0.00000000e+00 8.44965872e-02 0.00000000e+00 -1.59399264e-04
1.44000233e-01 0.00000000e+00 1.07718190e-01 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 -3.70872988e-02
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
9.31264783e-02 0.00000000e+00 0.00000000e+00 0.00000000e+00
-5.27716619e-02 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 -8.66752459e-02 0.00000000e+00
1.60625907e-01 0.00000000e+00 0.00000000e+00 0.00000000e+00
-5.99051582e-02 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 4.35048696e-02 0.00000000e+00 -4.90880002e-02
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 -9.75583410e-03 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 -5.85866895e-02
-4.12372907e-02 0.00000000e+00 3.39738431e-02 0.00000000e+00
0.00000000e+00 -3.28913870e-02 0.00000000e+00 0.00000000e+00
0.00000000e+00 -6.56889122e-02 0.00000000e+00 1.12313472e-01
0.00000000e+00 0.00000000e+00 -1.28921454e-02 0.00000000e+00
2.64238752e-02 0.00000000e+00 0.00000000e+00 -3.83728496e-02
0.00000000e+00 0.00000000e+00 0.00000000e+00 5.22824327e-03
0.00000000e+00 0.00000000e+00 1.60543359e-01 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 7.20355685e-02 0.00000000e+00
I 'think' this is affecting my code in a later stage which i am unable to share. Any thoughts?