I am attempting to match values of a 2d array with a list in order to create a new 2d array that contains the list and its corresponding values from the 2d array. Probably easier to understand in code than English...
import numpy as np
m_out = np.arange(50).reshape(25,2)
m_out_list = list(m_out[:,1])
eqn_out = range(7,17)
c_list = [(x,y) for x in eqn_out for y in m_out[:,0] if x in (m_out_list)]
print c_list
This code produces an answer I expect,
[(7, 0), (7, 2), (7, 4), (7, 6), ...
however it is not what I am attempting to accomplish. What I would like the last part of the list comprehension to do (or any other method that works) is to provide an array that matches the eqn_out list with it's corresponding unique original value; i.e
[(7,6), (9,8), (11,10), (13,12), (15,14), (17,16)]
I'm not sure how to do this exactly, any suggestions would be most appreciated.