PROJECT
Call Centre Resource Utilization Analytics
INTRODUCTION :-
Team of lead of the call centre, has got the below mentioned attribute
of their teams performance, he/she need to answer the below
mentioned queries to management in addition this the he/she need to
make the group of charts to form a dashboard for top manage on
performance of his/her department
LANGUAGE :- PYTHON
DATA BASE:- PYTHON PANDAS( DATA FRAME, SERIES )
CONNECTIVITY :- READING THROUGH CSV FILE / EXCEL FILE
IDE USED :- CANOPY
Task
1. Import the data in environment from link
http://www.gddatalabs.com/Tests/Call_Centre.xlsx
2. Make a function to accept the week number and share the below mentioned
values of respective week number.
Total Calls
Calls Answered
Avg Speed of Answer
Abandon Rate
Avg Call/Min
Satisfaction Overall
Calls of Less than 180 Seconds
% Calls of Less than 180 Seconds
Satisfaction less than equal to 3
3. Make a function to accept agent name and get the below mentioned values
of respective agent
Total Calls Calls Answered Avg Speed of Call Call Resolved
Answer Resolution %
CODING
import pandas as pd
def weekinfor(n,df):
if n==1:
dfweek=df[(df['ndate']>='2016-01-01') & (df['ndate']<='2016-01-07')]
elif n==2:
dfweek= df[(df['ndate']>='2016-01-08') & (df['ndate']<='2016-01-14')]
elif n==3:
dfweek= df[(df['ndate']>='2016-01-15') & (df['ndate']<='2016-01-21')]
elif n==4:
dfweek= df[(df['ndate']>='2016-01-22') & (df['ndate']<='2016-01-28')]
elif n==5:
dfweek= df[(df['ndate']>='2016-01-29') & (df['ndate']<='2016-01-31')]
else:
print("invalid week")
total_calls=dfweek['Call Id'].count()
print('Total calls of the week is :-', total_calls)
# Answerd call
call_ans=dfweek[dfweek['Answered']=='Y']['Call Id'].count()
print("total call answered :-",call_ans)
# Average speed of answer
avg_speed_ans=dfweek['Speed of Answer'].mean()
print("The average speed of answer is :- ", avg_speed_ans)
abandan_calls= total_calls-call_ans
print("Total abandon calls :- ", abandan_calls)
overall_satisfaction=dfweek['Satisfaction rating'].mean()
print("over all satisfaction:- ", overall_satisfaction)
# calculating calls of less the 180 second
h=0
m=0
s=0
total=0
l=[]
sind=dfweek.index
for x in sind:
h=int(df['nAvgTalkDuration'][x].strftime("%H"))
h=h*60*60
m=int(df['nAvgTalkDuration'][x].strftime("%M"))
m=m*60
s=int(df['nAvgTalkDuration'][x].strftime("%S"))
total=h+m+s
l.append(int(total))
dfweek.insert(10,'timeinsec',l)
callless180=dfweek[dfweek['timeinsec']<180]['Call Id'].count()
print("total calls less then 180 seconds :- ",callless180)
print(" % of call less then 180 sec " , callless180/len(sind)*100)
# satisfaction rating less then 3
print("satisfaction rating less then 3 :- ",dfweek[dfweek['Satisfaction rating']<3]['Call
Id'].count())
def getagentdetail(name,df):
dfname=df[df['Agent']==name]
print(dfname)
total_calls=dfname['Call Id'].count()
print("total call by ", name, total_calls)
call_ans=dfname[dfname['Answered']=='Y']['Call Id'].count()
print("total call answered :-",call_ans)
avg_speed_ans=dfname['Speed of Answer'].mean()
print("The average speed of answer is :- ", avg_speed_ans)
call_resolved=dfname[dfname['Resolved']=='Y']['Call Id'].count()
print("call resolved :- ", call_resolved)
call_not_resolved=dfname[dfname['Resolved']=='N']['Call Id'].count()
print("call not resolved ", call_not_resolved)
print("% of call resolved ", call_resolved/total_calls*100)
df=pd.read_csv("C://Users//adminpc//Desktop//book//workshop//Call_Centre.csv")
dfdate=pd.to_datetime(df['Date'])
dfdate=pd.DataFrame(dfdate,columns=['Date'])
df.insert(1,'ndate',dfdate['Date'])
df['AvgTalkDuration'].fillna('00:00:00',inplace=True)
dfdate=pd.to_datetime(df['AvgTalkDuration'])
dfdate=pd.DataFrame(dfdate,columns=['AvgTalkDuration'])
df.insert(9,'nAvgTalkDuration',dfdate['AvgTalkDuration'])
# removing unnessary column
df.drop('Unnamed: 10',1,inplace=True)
df.drop('Unnamed: 9',1,inplace=True)
n=int(input("enter week number ( 1 to 5)"))
weekinfor(n,df)
getagentdetail('Diane',df)