title: Get column name where value is something in pandas dataframe
body: <p>I'm trying to find, at each timestamp, the column name in a dataframe for which the value matches with the one in a timeseries  at the same timestamp.</p>
  
  <p>Here is my dataframe:</p>
  
  <pre><code>&gt;&gt;&gt; df
                              col5        col4        col3        col2        col1
  1979-01-01 00:00:00  1181.220328  912.154923  648.848635  390.986156  138.185861
  1979-01-01 06:00:00  1190.724461  920.767974  657.099560  399.395338  147.761352
  1979-01-01 12:00:00  1193.414510  918.121482  648.558837  384.632475  126.254342
  1979-01-01 18:00:00  1171.670276  897.585930  629.201469  366.652033  109.545607
  1979-01-02 00:00:00  1168.892579  900.375126  638.377583  382.584568  132.998706
  
  &gt;&gt;&gt; df.to_dict()
  {'col4': {&lt;Timestamp: 1979-01-01 06:00:00&gt;: 920.76797370744271, &lt;Timestamp: 1979-01-01 00:00:00&gt;: 912.15492332839756, &lt;Timestamp: 1979-01-01 18:00:00&gt;: 897.58592995700656, &lt;Timestamp: 1979-01-01 12:00:00&gt;: 918.1214819496729}, 'col5': {&lt;Timestamp: 1979-01-01 06:00:00&gt;: 1190.7244605667831, &lt;Timestamp: 1979-01-01 00:00:00&gt;: 1181.2203275146587, &lt;Timestamp: 1979-01-01 18:00:00&gt;: 1171.6702763228691, &lt;Timestamp: 1979-01-01 12:00:00&gt;: 1193.4145103184442}, 'col2': {&lt;Timestamp: 1979-01-01 06:00:00&gt;: 399.39533771666561, &lt;Timestamp: 1979-01-01 00:00:00&gt;: 390.98615646597591, &lt;Timestamp: 1979-01-01 18:00:00&gt;: 366.65203285812231, &lt;Timestamp: 1979-01-01 12:00:00&gt;: 384.63247469269874}, 'col3': {&lt;Timestamp: 1979-01-01 06:00:00&gt;: 657.09956023625466, &lt;Timestamp: 1979-01-01 00:00:00&gt;: 648.84863460462293, &lt;Timestamp: 1979-01-01 18:00:00&gt;: 629.20146872682449, &lt;Timestamp: 1979-01-01 12:00:00&gt;: 648.55883747413225}, 'col1': {&lt;Timestamp: 1979-01-01 06:00:00&gt;: 147.7613518219286, &lt;Timestamp: 1979-01-01 00:00:00&gt;: 138.18586102094068, &lt;Timestamp: 1979-01-01 18:00:00&gt;: 109.54560722575859, &lt;Timestamp: 1979-01-01 12:00:00&gt;: 126.25434189361377}}
  </code></pre>
  
  <p>And the time series with values I want to match at each timestamp:</p>
  
  <pre><code>&gt;&gt;&gt; ts
  1979-01-01 00:00:00    1181.220328
  1979-01-01 06:00:00    657.099560
  1979-01-01 12:00:00    126.254342
  1979-01-01 18:00:00    109.545607
  Freq: 6H
  
  &gt;&gt;&gt; ts.to_dict()
  {&lt;Timestamp: 1979-01-01 06:00:00&gt;: 657.09956023625466, &lt;Timestamp: 1979-01-01 00:00:00&gt;: 1181.2203275146587, &lt;Timestamp: 1979-01-01 18:00:00&gt;: 109.54560722575859, &lt;Timestamp: 1979-01-01 12:00:00&gt;: 126.25434189361377}
  </code></pre>
  
  <p>Then the result would be:</p>
  
  <pre><code>&gt;&gt;&gt; df_result
                               value  Column
  1979-01-01 00:00:00    1181.220328  col5
  1979-01-01 06:00:00    657.099560   col3
  1979-01-01 12:00:00    126.254342   col1
  1979-01-01 18:00:00    109.545607   col1
  </code></pre>
  
  <p>I hope my question is clear enough. Anyone has an idea how to get df_result?</p>
  
  <p>Thanks</p>
  
  <p>Greg</p>