title: Pandas: for every row value in several columns, turn it into a new row
body: <p>I have a <code>dataframe</code> with a bunch of pictures every row. What I want to do is turn it into a format for machine learning, so every pic will predict the list of attributes. </p>
  
  <p>For all pics, turn them into a row and the rest of the row would be the original row it was on. It will be easier to demonstrate it visually:</p>
  
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  
  df1 = pd.DataFrame({'Name':['Mark', 'Laura', 'Adam'],
                     'City':['Lisbon', 'Montreal', 'Lisbon'],
                     'Picture Col 1': ['Pic 47', 'Pic 36', 'Pic 15'],
                     'Picture Col 2': ['Pic 54', 'Pic 84', 'Pic 48']})
  </code></pre>
  
  <pre><code>    Name      City Picture Col 1 Picture Col 2
  0   Mark    Lisbon        Pic 47        Pic 54
  1  Laura  Montreal        Pic 36        Pic 84
  2   Adam    Lisbon        Pic 15        Pic 48
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre class="lang-py prettyprint-override"><code>df2 = pd.DataFrame({'Picture':['Pic 47', 'Pic 36', 'Pic 15', 'Pic 54', 'Pic 84', 'Pic 48'],
                      'Name': ['Mark', 'Laura', 'Adam', 'Mark', 'Laura', 'Adam'],
                      'City':['Lisbon', 'Montreal', 'Lisbon', 'Lisbon', 'Montreal', 'Lisbon']})
  </code></pre>
  
  <pre><code>  Picture   Name      City
  0  Pic 47   Mark    Lisbon
  1  Pic 36  Laura  Montreal
  2  Pic 15   Adam    Lisbon
  3  Pic 54   Mark    Lisbon
  4  Pic 84  Laura  Montreal
  5  Pic 48   Adam    Lisbon
  </code></pre>
  
  <p>Every picture should be a predictor to multiple attributes. Is this <code>melt</code>, <code>pivot</code>, <code>unstack</code>? I wouldn't even know.</p>