Python Forum

Full Version: How to aggregate rows with same column
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

From this input:

google.com, hello, blublu
google.com, hello, blabla
google.com, nothello, bleble
facebook.com, hi, blabla
facebook.com, hey, bleble

how can i generate this output:

google.com | hello, hello, nothello | blublu, blabla, bleble
facebook.com | hi, hey | blabla, bleble

It's important to not delete same values (i.e. "hello, hello" in the second column of the output must remains because each input's rows is an identificative and when i see the output i would understand from which input come from).

How could i do that?

Thanks
Alex
what are your python expertise?
if you can't start, I would suggest the starting point be a python tutorial.
and start with the latest version of python 3.7.0.
there are many tutorials available, run google and search for 'best python tutorials'
one of my favorites is: https://www.python-course.eu/