title: python dataframe transposing like SAS
body: <p>I am using python 3 with pandas and need to transpose a dataframe, like sas' <code>proc transpose</code>. I am using below code, which is not working. Hopefully the codelet makes you understand my goal. I marked the 'not working' codes....</p>
  
  <pre><code>byvars = ['Unique_Id','Month']
  dfrm = test_data
  idvars = 'Activity_Type'
  prefix = 'test'
  
  var_vars = [for i in list(dfrm) if list(dfrm) not in byvars,idvars] # ------ Not Working
  
  dfrm_txp = dfrm[byvars].drop_duplicates()
  
  for i in dfrm[idvars].drop_duplicates():
      dfrm_txp = pd.merge(dfrm_txp,dfrm[dfrm[idvars]==i].drop(idvars, axis = 1),
                          on = byvars,how='outer')
  
      dfrm_txp = dfrm_txp.rename(columns = {var_vars :prefix + var_vars +'_' + str(i)}) # ---- Not Working
  </code></pre>