Skip to content
Advertisement

How to use groupby to concatenate strings in python pandas? [duplicate]

I currently have dataframe at the top. Is there a way to use a groupby function to get another dataframe to group the data and concatenate the words into the format like further below using python pandas?

Thanks

[enter image description [1]

Advertisement

Answer

You can apply join on your column after groupby:

JavaScript

Example:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement