title: Transpose some rows to columns pandas
body: <p>I am using pandas (python) and have a dataframe where I want to keep some columns as they are and transform some columns into rows in order to reduce the number of columns and to also not lose the data in the columns. For example, the following is my dataframe:</p>
  
  <pre><code>ID  Name  Gender       R1      R2      R3      R4      R5     R6
  -------------------------------------------------------------------
  01  Abc     M          A1      A2      B3      B1      D2     A3
  02  Cde     F          A2      B1      B2      D1      C2     C3
  </code></pre>
  
  <p>I would like to keep the id, name, gender as they are and transform the R's columns into rows, such as:</p>
  
  <pre><code>ID  Name Gender  R  R_no
  ------------------------
  01  Abc     M    A1  1
  01  Abc     M    A2  2
  01  Abc     M    B3  3
  01  Abc     M    B1  4
  01  Abc     M    D2  5
  01  Abc     M    A3  6
  02  Cde     F    A2  1
  02  Cde     F    B1  2
  02  Cde     F    B2  3
  02  Cde     F    D1  4
  02  Cde     F    C2  5
  02  Cde     F    C3  6
  </code></pre>
  
  <p>Can anyone help me with this? Thanks in advance!</p>