Consider following example
index_abcd = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'] data = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] df = pd.DataFrame(data, index=index_abcd) index_id= df.index I want to find the position of 'a' in the index "index_id". How do I do that. Trying
index_id.index('a') does not work (error 'Index' object has no attribute 'index'). Thanks a lot
enumerate(), like[i for i, x in enumerate(index_id) if x == 'a']. But this approach doesn't seem to be optimal if the list gets too big