title: Pandas - Performing a transpose of multiple columns
body: <p>I have a Dataframe as below:</p>
  
  <pre><code>col1,col2,col3,col4
  value1,value2,value3,value4
  </code></pre>
  
  <p>I am trying to perform a transpose function on them to get the below output:</p>
  
  <pre><code>col1,value1
  col2,value2
  col3,value3
  col4,value4
  </code></pre>
  
  <p>The problem is the list of columns are dynamic and it depends on user input that pulls the respective columns at the first place.</p>
  
  <p>Use the below query to get the list of columns the user has requested:</p>
  
  <pre><code>cursor.execute('select {} from table'.format(', '.join(str(cols) for cols in col_names)))
  </code></pre>
  
  <p>Could anyone advice how I could perform a transpose of such a dataframe that has multiple columns but just one row of output. Thanks..</p>