title: Lambda + Apply to get two new columns in Pandas
body: <p>I have df looks like:</p>
  
  <pre><code>Name                 Item
  A,D,B,B,C,C      I1,I2,I3,I1,I2
  X,Y,Z,Z,Z            I4,I1,I1,I88,I4 
  </code></pre>
  
  <p><strong>Expected Output:</strong></p>
  
  <pre><code>Name            Item         Unique_Name  Unique_Item Count_Unique_name  Count_Unique_Item
  A,D,B,B,C,C  I1,I2,I3,I1,I2    A,B,C,D      I1,I2,I3         4             3             
  X,Y,Z,Z,Z   I4,I1,I1,I88,I4    X,Y,Z       I4,I1,I88         3             4
  </code></pre>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>new_items_df['Unique_Name'] = new_items_df['Name'].apply(lambda x: set(x.lower().split(",")))
  new_items_df['Unique_Item'] = new_items_df['Item'].apply(lambda x: set(x.lower().split(",")))
  new_items_df['Count_Unique_Name'] = new_items_df['Unique_Modifier'].apply(lambda x: len(x))
  new_items_df['Count_Unique_Item'] = new_items_df['Unique_Item'].apply(lambda x: len(x))
  </code></pre>
  
  <p>The above code works fine but I am doing same operation and running the same code twice. When I am trying to merge the 1st two lines of code like below:</p>
  
  <pre><code>new_items_df[['Unique_Name','Unique_Item']] = new_items_df[['Name','Item']].apply(lambda x: set(x.str.lower().str.split(",")),axis =1)
  </code></pre>
  
  <blockquote>
    <p>TypeError: ("unhashable type: 'list'", 'occurred at index 0')</p>
  </blockquote>
  
  <p>I tried to use <code>.unique()</code>also, tried converting that as a list by using <code>[]</code>, but nothing seems to work, I am getting one error or another</p>
  
  <p><strong>Summarize:</strong></p>
  
  <p>So, Can I get a help in combining my 4 lines of code to 1 line ?</p>