title: Iterating over a data frame, creating a dictionary based on values
body: <p>I am trying to iterate through a dataframe in pandas and generate a dictionary based off of the values in a column. I am interested in capturing the column name every time the value in the column is equal to a value of 3. Given a dataframe below:</p>
  
  <pre><code>Sample         Variable 1    Variable 2    Variable 3
  Sample 1          1                3             1
  Sample 2          3                0             3
  Sample 3          3                3             3
  Sample 4          2                1             3
  </code></pre>
  
  <p>I am interested in creating a dictionary that gives me:</p>
  
  <pre><code>{'Sample 1': [Variable 2], 'Sample 2': [Variable 1, Variable3], 'Sample 3': [Variable 1, Variable 2, Variable 3], 'Sample 4': [Variable3]}
  </code></pre>