Vectorized lookup on a pandas dataframe
问题 I have two DataFrames . . . df1 is a table I need to pull values from using index, column pairs retrieved from multiple columns in df2. I see there is a function get_value which works perfectly when given an index and column value, but when trying to vectorize this function to create a new column I am failing... df1 = pd.DataFrame(np.arange(20).reshape((4, 5))) df1.columns = list(\'abcde\') df1.index = [\'cat\', \'dog\', \'fish\', \'bird\'] a b c d e cat 0 1 2 3 4 dog 5 6 7 8 9 fish 10 11 12