-2

enter image description here

i have DataFrame as above.

Expected output dec-18,19,20 jan-3,4,5

manju
  • 1
  • 1

1 Answers1

-1

Use pandas.DataFrame.groupby

df.groupby('month').agg({'date': lambda x: ",".join(set(x))})
Mohammad Ayoub
  • 379
  • 2
  • 9