title: How to rename many groups of rows in Pandas?
body: <p>I have a list of lists:</p>
  
  <p>result_list = [[10x20], [10x10], [10x5], [10x2], [10x20, [10x10], [10x5] ....[10x2]]</p>
  
  <p>Inside each [ ] there are 10 values. I imported this list of lists to a Pandas Dataframe,I calculated the average and rounded to 2 decimals. </p>
  
  <p>I need to rename the rows. As an image is better to explain, I added 2 pictures.</p>
  
  <p>Dataframe I have: 
  <a href="https://i.stack.imgur.com/BW2ti.png" rel="nofollow"><img src="https://i.stack.imgur.com/BW2ti.png" alt="enter image description here"></a></p>
  
  <p>Dataframe I need: 
  <a href="https://i.stack.imgur.com/SEt7e.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/SEt7e.jpg" alt="enter image description here"></a> </p>
  
  <p>Now the code:</p>
  
  <pre><code>   df.loc['AWA'] = [[0:4], :]
     df.loc['REM'] = [[4:8], :]
     df.loc['S1'] = [[8:12], :]
     df.loc['S2'] = [[12:16], :]
     df.loc['SWS'] = [[16:20], :]
     df.loc['stades'] = [[20:24], :]
  </code></pre>
  
  <p>I also thought of "group by". But how can I use it when my rows do not have a name?</p>