'In python To get specified month & date for example: dec-18,19,20 jan-3,4,5

enter image description here

i have DataFrame as above.

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



Solution 1:[1]

Use pandas.DataFrame.groupby

df.groupby('month').agg({'date': lambda x: ",".join(set(x))})

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mohammad Ayoub