I have a python list as follows.
list=['M', 'R', 'W']
and a numpy array as follows.
array=[['M',360.0, 360.0],['R', 135.9, 360.0],['W', 101.4, -125.4], ['Y', 115.8, -160.4]]
I want to compare each element in this list with the first column of array and then create a new_array with the elements matched. So the typical output would be as follows.
new_array=[['M',360.0, 360.0],['R', 135.9, 360.0],['W', 101.4, -125.4]]
I tried the following code.
new_array=np.empty((4,3))
for i in range (0,len(list)):
if list[i]==array[i; 0:1]
new_array=np.append(new_array, (array[i,1:4].reshape(4,3)), axis=0)