title: python: how to melt dataframe retaining specific order / custom sorting
body: <p>I have a dataframe df</p>
  
  <pre><code>Cat  B_1 A_2 C_3
  A      1   2   3
  B      4   5   6
  C      7   8   9
  </code></pre>
  
  <p>which I want to convert into a dataframe so that the rows in column Label are following the order of df columns for each category.</p>
  
  <pre><code>Desired output
  
      Cat Label Value
      A     B_1    1
      A     A_2    2
      A     C_3    3
      B     B_1    4
      B     A_2    5
      B     C_3    6
      C     B_1    7
      C     A_2    8
      C     C_3    9  
  </code></pre>
  
  <p>when I try the </p>
  
  <pre><code>pd.melt(df, id_vars=["Cat"], var_name="Label",value_name="Value")
  </code></pre>
  
  <p>I lose the desired order in column Label, the results are sorted like below,</p>
  
  <pre><code>Cat Label Value
  A     B_1    1
  B     B_1    4
  C     B_1    7
  A     A_2    2
  ...
  </code></pre>
  
  <p><strong>Can the desired order of rows be forced in the melt function?
  if not, how can be this custom sorting achieved?</strong></p>
  
  <hr>
  
  <p>UPDATE</p>
  
  <p>I renamed the labels as they don't follow the alphabetical order, so that simple  sorting doesn't work</p>