import pandas as pd
df = pd.DataFrame({'A':[1,2,3], 'B':[4,5,6]},
index=['first','second','third'])
Retrieving the corresponding indeces from a given list of row numbers is simple:
df.iloc[[1,2]].index
But what about the converse? Suppose I am given a list ['second','third']. How can I return df's row numbers 0 and 1 from that?