0

I'm having a CSV file which has some 1000 rows and 20 columns. In this one column is having a sentences of am facing login issues, need It support, I'm not able to hear audio/headset issue, I'm not able to login. What am trying is, to segregate the issues, and find out how many has been reported for audio/headset and how many has been reported for login issues and so on

Since i'm just began to learn python yesterday, i need some advice on how to do it.

Ps - I'm able to find the unique values present in the columns but lacking how to proceed after this step :(

Thanks Aravind S

aravindex
  • 3
  • 1
  • 1
    Please provide [reproducible sample data](https://stackoverflow.com/questions/20109391) and show the desired output. – Bill Huang Oct 13 '20 at 15:49
  • Hi Bill, Pls download the CSV file from the below link, https://github.com/aravindroxx/Aravind.git – aravindex Oct 13 '20 at 17:26
  • Desired output is each sentences contains a keyword like login, failure issues based on that i'm trying to categorize each incident and trying to get a count for each category. Example - login issues - 24, Head set issue - 16, Meeting joining issue - 17 something like this – aravindex Oct 13 '20 at 17:29

1 Answers1

0

This code should work if you don't care about the content and only want to count the number of issues per keyword (just set your own keyword list):

keywords = ['login', 'audio']

for keyword in keywords:
    df['Summary'] = df['Summary'].apply(lambda issue: keyword if keyword in issue else issue)

for elem in df.groupby(['Summary']):
    keyword = elem[0]
    number_of_issues = elem[1].shape[0]
    print('{} issues - {}'.format(keyword, number_of_issues))
Yahav Festinger
  • 985
  • 2
  • 8
  • 17
  • 1
    Hi Festinger, thanks for this. its working :) i've voted for ur comment, unfortunately i'm a newbie to stack overflow so it requires 15 or more reputation to show my vote to the public world :( – aravindex Oct 17 '20 at 13:20
  • @aravindex You are welcome to mark the answer as Accepted if it solve your problem :) – Yahav Festinger Oct 18 '20 at 09:04