Reputation: 88
Could somebody tell me how to simplify this piece of code? It is archaic to write all the column names, specially on wide tables. For some reason if I run df.groupby('APID').agg(','.join)
it does not return all the columns. Only the first 3. All the columns are of type 'object'
.
df.groupby('APID').agg(
{'Names':','.join,
'Alias_Name':','.join,
'APID':','.join,
'Prev_Rep':','.join,
'Rep_Assigned':','.join,
'City':','.join,
'State':','.join,
'Zip_Code':','.join,
'Country':','.join,
'Distribution_Numbers':','.join,
'Partnership':','.join,
'Onboarding':','.join,}
)
Upvotes: 0
Views: 717