title: Python: Loop Through All Column Headers In DataFrame and Create New Dictionary For Each Column Header With Key:Value Pairs Based on Two Columns
body: <p>I currently have the sample dataset below</p>
  <p><a href="https://i.stack.imgur.com/zSfeu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zSfeu.png" alt="enter image description here" /></a></p>
  <p>I want to do the following:</p>
  <ol>
  <li>Create a variable for each column header (except house) that holds a data dictionary</li>
  <li>The data dictionary from above holds the &quot;House&quot; number as the key and info from that column as the value</li>
  </ol>
  <p>For example if I typed in <code>Bedrooms</code> in Python the resulting output would be:</p>
  <pre><code>{'House1': 0,
   'House2': 1,
   'House3': 4,
   'House4': 3}
  </code></pre>
  <p>Or if I typed in <code>condition</code>: result would be</p>
  <pre><code>{'House1': new,
   'House2': old,
   'House3': old,
   'House4': new}
  </code></pre>
  <p>I tried the code below:</p>
  <pre><code>for col in df.columns: 
      col = dict(zip(foods_vector, df[col]))
  </code></pre>
  <p>But the above code is wrong because it doesn't save each dictionary to its corresponding header column variable.</p>