[Pandas]: Combining rows of Dataframe based on same column values

Viewed 3600

I have a dataframe like the one below -

enter image description here

How can I combine the rows such that all the neighbourhoods belonging to the same Postcode are displayed in the same row seperated by commas. Something like this -

| Postcode | Borough | Neighbourhood |

| M1B | Scarborough | Rouge, Malvern |

| M5A | Downtown Toronto | Harbourfront, Regent Park |

| M6A | North York | Lawrence Heights, Lawrence Manor |

and the rest of the rows as they are...

0 Answers
Related