title: How to group by unique values pandas groupby
body: <p>Before I ask my question, I want it to be known that I looked at the following page but it did not return what I need specifically:</p>
  
  <p><a href="https://stackoverflow.com/questions/41415017/count-unique-values-using-pandas-groupby">Count unique values using pandas groupby</a></p>
  
  <p>Let's say I have the following df of four individuals trying to guess a code. Each individual has two guesses:</p>
  
  <pre><code>df = pd.DataFrame({'name':['Sally', 'John', 'Lucy', 'Mark','Sally', 'John', 'Lucy', 'Mark'], 
                     'guess':['123', '321', '213', '312', '321', '231', '123', '312']})
  
  df
  
      name    guess
  0   Sally   123
  1   John    321
  2   Lucy    213
  3   Mark    312
  4   Sally   321
  5   John    231
  6   Lucy    123
  7   Mark    312
  </code></pre>
  
  <p>I want to know how many completely unique guesses each individual has. That is, I don't want to know how many unique guesses each individual has out of their own guesses, rather, I want to know how many unique guesses they have out of all guesses. Let me elaborate.</p>
  
  <p>Using the code from the post linked above, this is what I get:</p>
  
  <pre><code>df.groupby('name')[['guess']].nunique()
  
  
        guess
  name    
  John    2
  Lucy    2
  Mark    1
  Sally   2
  </code></pre>
  
  <p>This returns how many unique guesses each individual has when compared to their own guesses. Again, what I am looking for is how many unique guesses each individual has out of all total guesses (aka the entire coulmn). This is the output I am looking for:</p>
  
  <pre><code>      guess count
  name    
  John    1     2
  Lucy    1     2
  Mark    0     2
  Sally   0     2
  </code></pre>
  
  <p>Because one of John's guesses (231) and one of Lucy's guesses (213) are unique out of all guesses. It would also be nice to have a column showing each individuals total guess count.</p>
  
  <p>Thank you in advance!</p>