I want to select the maximum value in a dataframe, and then find out the index and the column name of that value. Is there a way to do it?
Say, in the example below, I want to first find the max value (31
), and then return the index and column name of that value (20, R20D)
a = pd.DataFrame({'R05D':[1,2,3],'R10D':[7,4,3],'R20D':[31,2,4]},index=[20,25,30])
Thanks!