title: Reverse a get_dummies encoding in pandas
body: <p>Column names are: ID,1,2,3,4,5,6,7,8,9.</p>
  
  <p>The col values are either 0 or 1</p>
  
  <p>My dataframe looks like this:</p>
  
  <pre><code> ID     1    2    3    4    5    6   7   8   9 
  
  1002    0    1    0    1    0    0   0   0   0
  1003    0    0    0    0    0    0   0   0   0 
  1004    1    1    0    0    0    0   0   0   0
  1005    0    0    0    0    1    0   0   0   0
  1006    0    0    0    0    0    1   0   0   0
  1007    1    0    1    0    0    0   0   0   0
  1000    0    0    0    0    0    0   0   0   0
  1009    0    0    1    0    0    0   1   0   0
  </code></pre>
  
  <p>I want the column names in front of the ID where the value in a row is 1.</p>
  
  <p>The Dataframe i want should look like this:</p>
  
  <pre><code> ID      Col2
  1002       2    // has 1 at Col(2) and Col(4)
  1002       4    
  1004       1    // has 1 at col(1) and col(2)
  1004       2
  1005       5    // has 1 at col(5)
  1006       6    // has 1 at col(6)
  1007       1    // has 1 at col(1) and col(3)
  1007       3
  1009       3    // has 1 at col(3) and col(7)
  1009       7
  </code></pre>
  
  <p>Please help me in this, Thanks in advance</p>