Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

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.

Syntax:

DataFrame.lookup(self, row_labels, col_labels)

Parameters:

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

Notes

Akin to:

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

Example:


Download the Pandas DataFrame Notebooks from here.

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