title: Pandas duplicated vs groupby to flag all duplicate values
body: <p>I have a pretty simple need that has come up in a couple other posts, but I'm not sure if a better way to approach it is with a <code>groupby</code> or <code>duplicated</code> method.</p>
  
  <p>I have what I need below with <code>duplicated</code> <em>except</em> the first duplicate is being flagged as <code>FALSE</code> instead of <code>TRUE</code>. I need all duplicates as TRUE.</p>
  
  <p>My goal is to be able to concatenate data from two columns together when it's a duplicate, otherwise, leave the data as-is.</p>
  
  <p>Sample Input:</p>
  
  <pre><code>ID  File Name
  1   Text.csv
  2   TEXT.csv
  3   unique.csv
  4   unique2.csv
  5   text.csv
  </code></pre>
  
  <p>Desired Output:</p>
  
  <pre><code>ID  File Name   LowerFileName   Duplicate   UniqueFileName
  1   Text.csv    text.csv    TRUE    1Text.csv
  2   TEXT.csv    text.csv    TRUE    2TEXT.csv
  3   unique.csv  unique.csv  FALSE   unique.csv
  4   unique2.csv unique2.csv FALSE   unique2.csv
  5   text.csv    text.csv    TRUE    5text.csv
  
  
  df_attachment = pd.read_csv("Attachment.csv")
  df_attachment['LowerFileName'] = df_attachment['File Name'].str.lower()
  df_attachment['Duplicate'] = df_attachment.duplicated('LowerFileName')
  #This syntax is incorrect 
  df_attachment['UniqueFileName'] = np.where(df_attachment['Duplicate']=='TRUE', pd.concat(df_attachment['ID'],df_attachment['File Name']), df_attachment['File Name'))
  </code></pre>