title: How to find largest absolute value from specific columns for repetitive row elements using Pandas in Python and also display row and column index
body: <p>I am new to python. I want to find the top 2 largest values from all the columns for repetitive row elements (i.e. 5 to 4100), and also show its respective row and column index label in output.The largest value should be absolute. (Irrespective of + or - sign) My data structure is like image shown:</p>
  
  <p><img src="https://i.stack.imgur.com/9ICmm.jpg" alt="My Dataset"></p>
  
  <pre><code>df = pd.DataFrame({'E_at_0': [43, -53, 45, -17, 45, 19, 11, 32, 36, 32], 
                     'E_at_10': [-47, 47, 46, -18, 53, 16, 12, 34, -71, -34], 
                     'E_at_20': [56, 43, 41, 29, 36, 14, 13, -37, 43, 38], 
                     'E_at_30': [-46, 16, -40, 31, 42, 15, 63, -39, 52, 39]}, index=[5, 10, 12, 101, 4100, 5, 10, 12, 101, 4100])
  
  df.index.name='Ele_Num'
  </code></pre>
  
  <p>Ele_num column is my index column.</p>
  
  <p>The row indexs will keep on repeating for 'n'number of times. For every 'nth' data set, I want 2 largest values and their index positions.</p>
  
  <p>code is using pandas</p>
  
  <pre><code>df = pd.read_csv ('trial.csv')
  
  df = df.set_index('Ele_Num')
  
  s = df.abs().stack()
  
  mask = s == s.max()
  
  df1 = df.stack()[mask].reset_index()
  
  df1.columns = ['Element No','Column','Values']
  
  print (df1)
  
  df1.to_csv('trial_output.csv', encoding='utf-8', index=True)
  </code></pre>
  
  <p>Expected Results: </p>
  
  <p>For 1st set of rows (i.e. for index 5,10,12,101,4100)</p>
  
  <pre><code>                    Ele_Num   E_at_20
                        5          56
  
  </code></pre>
  
  <p>For 2nd set of rows (i.e.again for index 5,10,12,101,4100)</p>
  
  <pre><code>                    Ele_Num   E_at_10
                        101       -71
  
  </code></pre>
  
  <p>The row indexs will keep on repeating for 'n'number of times. For every 'nth' data set, I want 2 largest values and their index positions.</p>
  
  <p>Actual Results:</p>
  
  <p><img src="https://i.stack.imgur.com/LtfXg.png" alt="What I am getting"></p>
  
  <pre><code>  Ele_Num   E_at_30
      101       -71
  </code></pre>