Python Forum
How to aggregate rows with same column
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to aggregate rows with same column
#1
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
Reply
#2
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/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python and pandas: Aggregate lines form Excel sheet Glyxbringer 12 1,842 Oct-31-2023, 10:21 AM
Last Post: Pedroski55
  How to assign a value to pandas dataframe column rows based on a condition klllmmm 0 828 Sep-08-2022, 06:32 AM
Last Post: klllmmm
  df column aggregate and group by multiple columns SriRajesh 0 1,038 May-06-2022, 02:26 PM
Last Post: SriRajesh
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,630 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983
  Pandas DataFrame combine rows by column value, where Date Rows are NULL rhat398 0 2,111 May-04-2021, 10:51 PM
Last Post: rhat398
  Aggregate krisrajz 1 35,662 Apr-11-2021, 08:48 PM
Last Post: Yoriz
  Indexing [::-1] to Reverse ALL 2D Array Rows, ALL 3D, 4D Array Columns & Rows Python Jeremy7 8 7,106 Mar-02-2021, 01:54 AM
Last Post: Jeremy7
  How to filter out Column data From Multiple rows data? firaki12345 10 5,094 Feb-06-2021, 04:54 AM
Last Post: buran
  how to combine rows to a column base on ids zhujp98 0 1,495 Nov-03-2020, 04:10 PM
Last Post: zhujp98
  How to generate rows based on values in a column to fill missing values codesmatter 1 2,124 Oct-31-2020, 12:05 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020