title: Multi-index setup for Dataframe - pandas/Jupyter
body: <h1>Convert list to dictionary</h1>
  
  <pre><code>    self.internal_output_df = pd.DataFrame(list)
  </code></pre>
  
  <h1>Create labels</h1>
  
  <pre><code>    labels = [[str(i)] + [str(i) + '_' + str(x) for x in range(1, self.num_matches+1)]
                for i in range(1, len(self.df) + 1)]
      labels = [y for x in labels for y in x]
      self.internal_output_df['match'] = labels
  
  
      # Select final variables to display
      variables = [
          'a',
          'b',
          'c',
          'd',
          'e',
          'f',
          'g',
          'h'
      ]
  
  
      self.internal_output_df = self.internal_output_df.set_index('match')[variables]
  </code></pre>
  
  <p>"""Sample Data Format"""
  Format that I'm getting:
  <a href="https://i.stack.imgur.com/5yCJd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5yCJd.png" alt="Output that I&#39;m getting"></a></p>
  
  <p>Format that I want to generate:
  <a href="https://i.stack.imgur.com/ci2TN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ci2TN.png" alt="Output that I want to generate"></a></p>
  
  <p>"""
  QUESTION:
  I'm getting the label output as: </p>
  
  <pre><code>Row1: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5'] 
  Row2: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row3: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row4: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row5: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row6: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row7: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row8: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row9: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row10: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row11: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  Row12: ['1', '1_1', '1_2', '1_3', '1_4', '1_5','2', '2_1', '2_2', '2_3', '2_4', '2_5']
  </code></pre>
  
  <p>So the values of dataframe are getting repeated for every row in dataframe.</p>
  
  <p>I want to get the unique values of label output as single row for rows in dataframe as below format:</p>
  
  <pre><code>Row1: 1
  Row2: 1_1
  Row3: 1_2
  Row4: 1_3
  Row5: 1_4
  Row6: 1_5
  Row7: 2
  Row8: 2_1
  Row9: 2_2
  Row10: 2_3
  Row11: 2_4
  Row12: 2_5
  </code></pre>
  
  <p>So I do not want the rows to repeat the same values in every row.
  """</p>