title: Count unique values of a column given the values of another column
body: <p>So, I have a problem with something I thought it was relatively easy.</p>
  
  <p>I have a dataframe with three columns:</p>
  
  <pre><code>A  B  C
  x1 a  2
  x1 a  2
  x1 b  3
  x1 c  4
  x1 c  4
  x2 d  2
  x2 d  2
  x3 e  5
  x3 e  5
  </code></pre>
  
  <p>Now, if I want to now for each group of A (x1, x2, x3) how many unique values there are in B which in C are greater than 2, and assign this to a new column D which would return me the following</p>
  
  <pre><code>A  B  C  D
  x1 a  2  2
  x1 a  2  2
  x1 b  3  2
  x1 c  4  2
  x1 c  4  2
  x2 d  2  0
  x2 d  2  0
  x3 e  5  1
  x3 e  5  1
  </code></pre>
  
  <p>How should I get this in Python Pandas without using a for loop? Is this possible?</p>