title: pandas rows as column names - reshaping dataframe
body: <p>I have table in the following format:</p>
  
  <pre><code>  user_id   total_spent purchase_date   purchase_id aisle   department  item_cost
      33      279.3       1/29/18         26          gn      1           25.7
      33      279.3       1/29/18         26          aj      2           17
      33      279.3       1/29/18         26          bs      2           31.7
      33      279.3       1/29/18         26          jt      3           30
      33      279.3       1/29/18         26          tj      3           8.1
      33      279.3       1/29/18         26          ga      4           60.6
      33      279.3       1/29/18         26          tw      4           35.9
      33      279.3       1/29/18         26          aw      5           34.1
      33      279.3       1/29/18         26          te      5           36.2
      26      331.7       11/15/17        85          je      1           93.5
      26      331.7       11/15/17        85          tg      2           21.1
      26      331.7       11/15/17        85          ds      2           23.2
      26      331.7       11/15/17        85          jw      3           48.8
      26      331.7       11/15/17        85          df      3           10.2
      26      331.7       11/15/17        85          lj      4           56.2
      26      331.7       11/15/17        85          oa      4           7
      26      331.7       11/15/17        85          aw      5           32.4
      26      331.7       11/15/17        85          cm      5           39.3
  </code></pre>
  
  <p>And would like to convert it into each <strong>department value as a column name</strong> like <strong>department_1, department_2</strong> etc. Same as aisle and item cost: <strong>dept_aisle_gn, dept_aisle_df</strong> etc followed by corresponding cost as columns. </p>
  
  <p>In other words, in the end, I would like to have <strong>2 rows for 2 user_ids and the rest of the information will be shown in the columns rather than rows.</strong></p>
  
  <p>Originally I pulled the data from redshift and I will manipulate it with python pandas. Unfortunately, pivot or crosstab is not working for redshift. I tried pandas pivot but seems not working for me. </p>
  
  <p>Thank you.</p>