title: Python Pandas - Appending/updating key value pairs inside a dataframe with a dict column
body: <p>Having this dataframe</p>
  
  <pre class="lang-py prettyprint-override"><code>d = {'objects':[{'Sand':10},{'Seawater': 2, 'Crab': 30},{'Parasol': 50}]}
  df = pd.DataFrame(data=d)
  </code></pre>
  
  <p>I want this key-value pair</p>
  
  <pre class="lang-py prettyprint-override"><code>{'Small': 1000}
  </code></pre>
  
  <p>to be inserted to every row that has at least a key-value pair with a value of less than 40.</p>
  
  <pre class="lang-py prettyprint-override"><code>     objects
  0    {'Sand': 10, 'Small': 1000}
  1    {'Seawater': 2, 'Crab': 30, 'Small': 1000}
  2    {'Parasol': 50}
  </code></pre>
  
  <p>I have tried looping over it but it yields 'None'.</p>
  
  <pre class="lang-py prettyprint-override"><code>def your_small(x):
      if any(value &lt; 40 for value in x.values()):
          return x.update({'Small': 1000})
  
  d = {'objects':[{'Sand':10},{'Seawater': 2, 'Crab': 30},{'Parasol': 50}]}
  df = pd.DataFrame(data=d)
  df['objects'] = df['objects'].map(your_small)
  </code></pre>
  
  <pre><code>  objects
  0    None
  1    None
  2    None
  </code></pre>