def lookup(self, row_labels, col_labels):
n = len(row_labels)<EOL>if n != len(col_labels):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>thresh = <NUM_LIT:1000><EOL>if not self._is_mixed_type or n > thresh:<EOL><INDENT>values = self.values<EOL>ridx = self.index.get_indexer(row_labels)<EOL>cidx = self.columns.get_indexer(col_labels)<EOL>if (ridx == -<NUM_LIT:1>).any():<EOL><INDENT>raise KeyError('<STR_LIT>')<EOL><DEDENT>if (cidx == -<NUM_LIT:1>).any():<EOL><INDENT>raise KeyError('<STR_LIT>')<EOL><DEDENT>flat_index = ridx * len(self.columns) + cidx<EOL>result = values.flat[flat_index]<EOL><DEDENT>else:<EOL><INDENT>result = np.empty(n, dtype='<STR_LIT:O>')<EOL>for i, (r, c) in enumerate(zip(row_labels, col_labels)):<EOL><INDENT>result[i] = self._get_value(r, c)<EOL><DEDENT><DEDENT>if is_object_dtype(result):<EOL><INDENT>result = lib.maybe_convert_objects(result)<EOL><DEDENT>return result<EOL>
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_labels : sequence
    The row labels to use for lookup
col_labels : sequence
    The column labels to use for lookup

Notes
-----
Akin to::

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

Examples
--------
values : ndarray
    The found values