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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework