Nov-03-2022, 06:00 AM
(This post was last modified: Nov-03-2022, 06:00 AM by Steven5055.)
Hi,
I'm doing a Uni course & I'm a bit stuck & would appreciate some help please.
I have a column in a data frame that contains data as per below (no spacing)
ATTENDEES
John,Jan,Paul
Kylie,Paul,Scott,Jason
Jan,Scott,John
I' trying to seperate the data so I can show who is attending in a list like
ATTENDEES
John
Jan
Paul
Kylie
Scott
Jason
Then be able to count how many are attending
ATTENDEES
John 1
Jan 2
Paul 2
Kylie 1
Scott 2
Jason 1
I've tried splitting the names using
names=masterlist['attendees'].str.split(pat = ',', expand = True)
and counting by using
CountNames=names.groupby(0).count()
but it does not include all the data only the 1st new column from the split
and counting is across all columns.
Thanks in advance
Steve
I'm doing a Uni course & I'm a bit stuck & would appreciate some help please.
I have a column in a data frame that contains data as per below (no spacing)
ATTENDEES
John,Jan,Paul
Kylie,Paul,Scott,Jason
Jan,Scott,John
I' trying to seperate the data so I can show who is attending in a list like
ATTENDEES
John
Jan
Paul
Kylie
Scott
Jason
Then be able to count how many are attending
ATTENDEES
John 1
Jan 2
Paul 2
Kylie 1
Scott 2
Jason 1
I've tried splitting the names using
names=masterlist['attendees'].str.split(pat = ',', expand = True)
and counting by using
CountNames=names.groupby(0).count()
but it does not include all the data only the 1st new column from the split
and counting is across all columns.
Thanks in advance
Steve