Python Forum
Separating Names & Counting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Separating Names & Counting
#7
It worked, thanks for the guidance.
Was there another way I could have done this?

import pandas as pd
import os
party = pd.read_csv('party.csv')
data = party['ATTENDEES']
list = data.str.cat(sep=',').strip().split(',')
print(Counter(list).most_common())
Output:
[('John', 2), ('Jan', 2), ('Paul', 2), ('Scott', 2), ('Kylie', 1), ('Jason', 1)]

Also is there anyway of listing the names up/down rather than left/right..
Thanks
Reply


Messages In This Thread
Separating Names & Counting - by Steven5055 - Nov-03-2022, 06:00 AM
RE: Separating Names & Counting - by Larz60+ - Nov-03-2022, 07:32 AM
RE: Separating Names & Counting - by Steven5055 - Nov-03-2022, 08:20 AM
RE: Separating Names & Counting - by DeaD_EyE - Nov-03-2022, 10:08 AM
RE: Separating Names & Counting - by Steven5055 - Nov-04-2022, 04:36 AM
RE: Separating Names & Counting - by deanhystad - Nov-04-2022, 10:08 AM
RE: Separating Names & Counting - by Steven5055 - Nov-06-2022, 12:04 AM
RE: Separating Names & Counting - by deanhystad - Nov-06-2022, 12:52 PM

Forum Jump:

User Panel Messages

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