title: Run a function on a pandas column with strings and column of lists
body: <p>I'm trying to run several pieces of code on both the &quot;<strong>parent</strong>&quot; column and each element in the &quot;<strong>children</strong>&quot; column lists from below. The results I'm aiming for are in the &quot;<strong>resultsX</strong>&quot; column:</p>
  <p>The <strong>first</strong> code (shown in results1 column) snippet just takes two strings and gets the <strong>total unique characters in each</strong>:</p>
  <pre><code>&gt;&gt;&gt; len(set('max' + 'andi'))
  &gt;&gt;&gt; 6
  </code></pre>
  <p>The <strong>second</strong> piece of code (shown in results2 column)  counts the number of characters that are in the same position in two strings:</p>
  <pre><code>&gt;&gt;&gt; sum(1 if c1 == c2 else 0 for c1, c2 in zip('maxwell', ' axwell'))
  &gt;&gt;&gt; 6
  </code></pre>
  <p>I'd like to run these two pieces of code on the &quot;parent&quot; column and each element in the &quot;children&quot; column and get what's in the <strong>&quot;results1 and results2&quot;</strong> columns respectively:</p>
  <pre><code>parent           children                       results1                                     results2
  0   MAX          ['MAX', 'amx', 'akd']          [('MAX',3),('amx',3),('akd',5)]          [('MAX',3),('amx',0),('akd',0)]
  1   Sam          ['Sam','sammy','samsam']       [('Sam',3),('sammy',4), ('samsam',3)]      [('Sam',3),('sammy',3), ('samsam',3)]
  2   Larry        ['lar','lair','larrylamo']     [('lar',4),('lair',5), ('larrylamo',6)]  [('lar',3),('lair',3), ('larrylamo',5)]
  </code></pre>
  <p>I have tried this code below, but i get an error when i run it:</p>
  <pre><code>def total_chars(reference, value_list):
      chars = []
      for val in value_list:
          totalChars = len(set(reference + val))
          chars.append(val, reference)
          
      return totalChars
  
  df.agg(lambda x: total_chars(df.parent,df.children), axis=1)
  
  &gt;&gt;&gt; ValueError: operands could not be broadcast together with shapes (10000,) (4,) 
  </code></pre>
  <p>Any ideas?</p>