title: Pandas Dataframe Set value in cell if condition (Element is in list)
body: <p>I have a dataframe containing a column called &quot;column_B&quot; with only nan-values. It contains also &quot;column_A&quot;, which is a list of strings for every cell in the dataframe.</p>
  <pre><code>index   column_A    column_B  
  1       ['A','B']    np.nan
  2       ['B']        np.nan
  3       ['C']        np.nan
  </code></pre>
  <p>Now I want that column_B is set to 0 if any element in  a list of column_A contains 'B'.</p>
  <p>Desired result:</p>
  <pre><code>   index   column_A    column_B  
      1       ['A','B']    0
      2       ['B']        0
      3       ['C']        np.nan
  </code></pre>
  <p>I tried</p>
  <pre><code>df['column_B'][any([x == 'B' for x in df['column_A']])] = 0
  </code></pre>
  <p>that doesn't work.
  Any ideas? :)</p>
  <p>Thanks</p>