samples = np.array([[1, 5], [3, 7], [3, 7], [2, 6]])
samples = pd.DataFrame(samples, columns=['user', 'item'])
result = pd.merge(samples, df, how='inner')
result = result[['f1', 'f2', 'f3']]
result = result.values
print(result)
Select pandas frame rows based on two columns' values