title: Combine duplicate rows on specific column
body: <p>I am trying to combine rows of a dataframe in the event that there is a duplicate in one column. The dataframe looks like the following.</p>
  
  <pre><code>Name   Code   X   Y
   A     123   10   11
   B     456   12   13
   C     123   15   16
  </code></pre>
  
  <p>I want to combine on Code. So if the Code is the same, combine the other data separated by a comma. The resulting df would look like this:</p>
  
  <pre><code>Name   Code    X       Y
  A,C    123   10,15   11,16
   B     456    12       13
  </code></pre>
  
  <p>My approach was the following:   </p>
  
  <pre><code>    df = df.groupby(['Name','Code','Y'])['X'].astype(str).apply(', '.join).reset_index() 
  
      df = df.groupby(['Name','Code','X'])['Y'].astype(str).apply(', '.join).reset_index() 
  </code></pre>
  
  <p>I get the following error :</p>
  
  <pre><code>"Cannot access callable attribute 'astype' of 'SeriesGroupBy' objects, try using the 'apply' method"
  </code></pre>
  
  <p>I have been unable to figure out how to use apply to cast as type str, any tips?</p>