If we have a known value in a column, how can we get its index-value? For example:
In [148]: a = pd.DataFrame(np.arange(10).reshape(5,2),columns=[\'c1\',\'c2\'
Using the .loc[] accessor:
In [25]: a.loc[a['c1'] == 8].index[0] Out[25]: 4
Can also use the get_loc() by setting 'c1' as the index. This will not change the original dataframe.
In [17]: a.set_index('c1').index.get_loc(8) Out[17]: 4