I am having difficulty finding the unique multi index tuple of my dataframe
I am having difficulty finding the unique multi index tuple of my dataframe.
np.random.seed(0)
df = pd.DataFrame(np.random.randint(0,100,size=(100, 5)), columns=list('ABCDF'))
df = df.set_index(['A','B','C'])
print(df)
I need to find the nth row index i.e. the values in A,B,C.
This tuple which I pick up will then be used to query a separate df which appears to be working fine.
Any help would be appreciated
You can use:
df.index[n]
Example for the fifth (n=4) row:
(81, 37, 25)