title: Similar to a Pivot in Pandas
body: <p>I have a stupid problem that I can't seem to solve. I need to take a pandas dataframe like so:</p>
  
  <pre><code>id     part1    part2   part3   part4   part5
  23024   xyz9     23l    lk8     jkd9    298
  48392   xyz10    24x    29x      ef3    298
  </code></pre>
  
  <p>Now, i just want to "pivot" the table so that there are two columns displaying the ID and the parts:</p>
  
  <pre><code>id    Parts
  23024  xyz9
  23024  23l
  23024  lk8
  23024  jkd9
  23024  298
  48392  xyz10
  48392  29x
  48392  ef3
  48392  298
  </code></pre>
  
  <p>I started by getting all the unique IDs:</p>
  
  <pre><code>lst =[]
  for i in df['id']:
     if i is not None:
        lst.append(i)
  </code></pre>
  
  <p>Then tried a few functions to get the values, but failed:</p>
  
  <pre><code>    df_new = pd.DataFrame(columns=['id', 'parts'])
      for i in lst:
          temp_df = df.loc[df['id'] == i]
          for x in temp_df.columns:
              temp_list = []
              temp_list.append([str(i), str(temp_df[x][0])])
              temp_df = pd.DataFrame(temp_list, columns=['id', 'parts'])
              df = df.append(temp_df)
  </code></pre>
  
  <p>But I keep getting KeyErrors. What am I doing wrong?</p>