dataframe - Finding the maximum value for each column and the corspondace vlaue of a common column -


i trying maximum value each column in dataframe time occur.

l = [[1,6,2,6,7],[2,66,2,6,8],[3,44,2,44,8],[4,5,35,6,8],[5,3,9,6,95]] dft = pd.dataframe(l, columns=['time','25','50','75','100']) max_t = pd.dataframe() max_t['max_f'] = dft.loc[:, ['25','50','75','100']].max(axis=0) max_t 

i managed maximum value in each column, however, not figure out how time.

iiuc:

in [48]: dft out[48]:    time  25  50  75  100 0     1   6   2   6    7 1     2  66   2   6    8 2     3  44   2  44    8 3     4   5  35   6    8 4     5   3   9   6   95  in [49]: dft.set_index('time').agg(['max','idxmax']).t out[49]:      max  idxmax 25    66       2 50    35       4 75    44       3 100   95       5 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -