title: How to unpivot a pandas dataframe for a recommender dataset?
body: <p>I have the dataframe: </p>
  
  <pre><code>userId  |    0  |     1 | ..... |     N
  ----------------------------------------
  1          2.3      2.5             1.7
  2          4.5      3.1             1.5
  3          1.8      4.5             2.6
  4          3.4      4.2             2.8
  5          1.7      2.4             2.9
  ...
  </code></pre>
  
  <p>how can I unpivot this to get a dataframe of the form: </p>
  
  <pre><code>userId  |  itemId   | rating
  1            1          2.3
  1            2          2.5
  ...
  1            N          1.7
  2            1          4.5
  2            2          3.1
  ...
  2            N          1.5
  3            1          1.8
  ...
  </code></pre>
  
  <p>EDIT: </p>
  
  <p>Here is some pastable code: </p>
  
  <pre><code>arr = np.array([[2.3, 2.5, 1.7],
                  [4.5, 3.1, 1.5],
                  [3.4, 4.2, 2.8]])
  
  test_df = pd.DataFrame(arr)
  test_df['userId'] = list(range(1, test_df.shape[0]+1))
  </code></pre>