I have a list I
containing two indices [0,5]
and [5,8]
. I want to locate these indices in Ii
and print corresponding values according to Iv
. I present the current and expected outputs.
import numpy as np
I=[[0,5],[5,8]]
Ii=[np.array([[[ 0, 2],
[ 0, 5],
[ 2, 5],
[ 5, 8],
[ 5, 10],
[ 8, 9],
[ 8, 11],
[ 9, 11],
[10, 8]]])]
Iv=[np.array([[[0.45202266977297145],
[0.9977806946852882 ],
[0.5228951173127738 ],
[1.083230383898751 ],
[0.5533588101522955 ],
[0.5778527989444576 ],
[1.2288418160926498 ],
[0.5274353540288571 ],
[0.5818783538996267 ]]])]
A=[Iv for I in Ii]
print(A)
The current output is
[[array([[[0.45202266977297145],
[0.9977806946852882 ],
[0.5228951173127738 ],
[1.083230383898751 ],
[0.5533588101522955 ],
[0.5778527989444576 ],
[1.2288418160926498 ],
[0.5274353540288571 ],
[0.5818783538996267 ]]])]]
The expected output is
[0.9977806946852882 ],
[1.083230383898751 ],