pandas.DataFrame.lookup

DataFrame.lookup(self, row_labels, col_labels)[source]

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.

Parameters
row_labelssequence

The row labels to use for lookup

col_labelssequence

The column labels to use for lookup

Returns
numpy.ndarray

Notes

Akin to:

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

Examples

valuesndarray

The found values

Scroll To Top