title: use the count in groupby method as an if condition to do an analysis in pandas
body: <p>I have this dataframe:</p>
  
  <pre><code>df = pd.DataFrame( {'cn': [1, 1, 1, 1, 2, 2, 2, 3], 
        'date': ['01/10/2017', '02/09/2016', '02/10/2016','01/20/2017', '05/15/2019', '02/10/2016', '02/10/2017','02/5/2017' ],
        'score': [np.nan, np.nan, 6, 5, 4, np.nan, 8, np.nan]})
  
      cn  date    score
  0   1   01/10/2017  NaN
  1   1   02/09/2016  NaN
  2   1   02/10/2016  6
  3   1   01/20/2017  5
  4   2   05/15/2019  4
  5   2   02/10/2016  NaN
  6   2   02/10/2017  8.0
  7   3   02/5/2017   NaN
  </code></pre>
  
  <p>I want to first groupby the data based on the "cn" columns and if the count of data in each group is more than 1, then replace the null value with "0". otherwise, I want to replace the null value with a string such as "a". 
  the output should be:</p>
  
  <pre><code>    cn  date    score
  0   1   01/10/2017  0
  1   1   02/09/2016  0
  2   1   02/10/2016  6
  3   1   01/20/2017  5
  4   2   05/15/2019  4
  5   2   02/10/2016  0
  6   2   02/10/2017  8.0
  7   3   02/5/2017   a
  </code></pre>
  
  <p>This is my code: </p>
  
  <pre><code>df['score'] = np.where( df.groupby('cn')["date"].transform('count')&gt;1, df.score.fillna(0), df.score.fillna("a"))
  </code></pre>
  
  <p>But it did not work, would you please help me with it?</p>