I've this numpy array:
array([ 0.49010508, 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0.09438115, 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
-1. , -1. , -1. , -1. , -1. ,
-1. , -1. , -1. , -1. , -1. ,
-1. , -1. ])
which is the first row of the 5D numpy array called allSimilarity
. I have defined it with np.full()
and the fill_value
is -1. After computing, I would want to remove last unuseful -1
value. So, I calculate the size difference, but when I use np.delete()
or np.resize()
or allSimilarity[index1][index2][index3][index4] = allSimilarity[index1][index2][index3][index4][:diff].copy()
(where diff
is the size difference between old size and new size) I got this error:
ValueError: could not broadcast input array from shape (55) into shape (67)
Any advice?
Thanks in advance.