title: Groupby one column and find duplicates from another column then return indications in Python
body: <p>Given a small dataset <code>df</code> as follows, I need groupby <code>floor</code>, find duplicates in <code>room</code> then return <code>check</code> column in Pandas:</p>
  <pre><code>   id  floor   room
  0   1      1  101.0
  1   2      1  102.0
  2   3      2  201.0
  3   4      2  201.0
  4   5      2  202.0
  5   6      3    NaN
  6   7      3  201.0
  7   8      3  301.0
  </code></pre>
  <p>I would like to use code as follows since there are many other columns to check:</p>
  <pre><code>a = np.where(condition, None, 'duplicates')
  # b = np.where(df.area.str.contains('^\d+$', na = True), None,
  #                                  'area is not a numbers')  
  f = (lambda x: ';'.join(y for y in x if pd.notna(y)) 
                  if any(pd.notna(np.array(x))) else np.nan )
  df['check'] = [f(x) for x in zip(a)]
  </code></pre>
  <p>The expected result will like this:</p>
  <pre><code>   id  floor   room       check
  0   1      1  101.0         NaN
  1   2      1  102.0         NaN
  2   3      2  201.0  duplicates
  3   4      2  201.0  duplicates
  4   5      2  202.0         NaN
  5   6      3    NaN         NaN
  6   7      3  201.0         NaN
  7   8      3  301.0         NaN
  </code></pre>
  <p>How could I modify the condition code? Thanks for your help at advance.</p>