Pandas DataFrame: lookup() function

DataFrame - lookup() function

The lookup() function returns label-based "fancy indexing" function for DataFrame.

Given equal-length arrays of row and column labels, return an array of the values corresponding to each (row, col) pair.


DataFrame.lookup(self, row_labels, col_labels)


Name Description Type/Default Value Required / Optional
row_labels  The row labels to use for lookup sequence Required
col_labels The column labels to use for lookup sequence Required

Returns: numpy.ndarray


Akin to:

result = [df.get_value(row, col)
          for row, col in zip(row_labels, col_labels)]


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - itertuples() function
Next: DataFrame - pop() function

Follow us on Facebook and Twitter for latest update.

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook