title: Transform with group by in Pandas
body: <p>I am creating a Dataframe   </p>
  
  <pre><code>import pandas as pd
  
   df1 = pd.DataFrame( {     
  "Name" : ["Alice", "Bob", "Mallory", "Mallory", "Bob" , "Mallory"] ,           
  "City" : ["Seattle", "Seattle", "Portland", "Seattle", "Seattle",     
  "Portland"]   } )          
  
  df1.groupby( ["City"] )['Name'].transform(lambda x:     
  ','.join(x)).drop_duplicates()      
  I want the output as      
  
  Name    City                 
  Alice,Bob,Mallory,Bob     Seattle           
  Mallory,Mallory    Portland        
  
  but i am getting only           
  Name         
  Alice,Bob,Mallory,Bob                
  Mallory,Mallory        
  
  This is an example with small number of columns but in my actual problem i 
  have too many columns so i cannot use           
  df1['Name']= df1.groupby( ['City'] )['Name'].transform(lambda x:         
  ','.join(x))              
  df1.groupby( ['City','Name'], as_index=False )              
  df1.drop_duplicates()          
  </code></pre>
  
  <p>because for each column i have to write the same code<br>
  Is there any way to do it without writing transform for each column 
  individually.       </p>