chevron_left
Data Selection and Renaming
Method add_prefixMethod add_suffixMethod alignMethod at_timeMethod between_timeMethod dropMethod drop_duplicatesMethod duplicatedMethod equalsMethod filterMethod firstMethod getMethod headMethod idxmaxMethod idxminMethod lastMethod lookupMethod queryMethod reindexMethod renameMethod rename_axisMethod reset_indexMethod sampleMethod select_dtypesMethod set_axisMethod set_indexMethod tailMethod takeMethod truncate
0
0
0
new
Pandas DataFrame | lookup method
Programming
chevron_rightPython
chevron_rightPandas
chevron_rightDocumentation
chevron_rightDataFrame
chevron_rightData Selection and Renaming
schedule Mar 10, 2022
Last updated Python●Pandas
Tags tocTable of Contents
expand_more Pandas DataFrame.lookup(~)
method extracts individual values from the source DataFrame in a single Numpy Array.
Parameters
1. row_labels
| sequence
of strings
The row labels of the values you want to fetch.
2. col_labels
| sequence
of strings
The column label of the values you want to fetch.
Return Value
A Numpy array of values.
Examples
Consider the following DataFrame:
df = pd.DataFrame({"A":[5,8],"B":[6,7],"C":[2,9]}, index=["a","b"])df
A B Ca 5 6 2b 8 7 9
To fetch the values at (a,B)
and (b,C)
:
df.lookup(row_labels=["a","b"], col_labels=["B","C"])
array([6, 9])
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?
Ask a question or leave a feedback...
Official Pandas Documentation
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.lookup.html