You could use apply (docs), but a faster way to do this if you have a lot of data would be to create a version of df2 with a MultiIndex (docs) using stack (docs) and look up values on this new DataFrame.