Japneet's File
Japneet's File
TEACHER’S
SIGNATURE
INTRODUCTION
TASK
CODING
OUTPUT
BIBLIOGRAPHY
Add 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
a subheading
LANGUAGE :-PYTHON
DATA BASE:-PYTHON
PANDAS(DATA FRAME, SERIES )
CONNECTIVITY :-READING
THROUGH CSV FILE / EXCEL FILE
IDE USED :- CANOPY
Make a function to accept the week number
and share the below mentioned values of
respective week number.
Make a function to accept
agent name and get the
below mentioned values of
respective agent
Add a 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()
Add a 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)
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(r"D:\Call Center\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'])
weekinfor(n,df)
getagentdetail('Diane',df)
enter week number ( 1 to 5)1
Total calls of the week is :- 398
total call answered :- 324
The average speed of answer is :- 69.75617283950618
Total abandon calls :- 74
over all satisfaction:- 3.441358024691358
total calls less then 180 seconds :- 202
% of call less then 180 sec 50.753768844221106
satisfaction rating less then 3 :- 63
Call Id ndate Date Agent Department Answered Resolved \
0 ID0001 2016-01-01 1-Jan-16 Diane Washing Machine Y Y
6 ID0007 2016-01-01 1-Jan-16 Diane Toaster Y Y
7 ID0008 2016-01-01 1-Jan-16 Diane Toaster Y Y
24 ID0025 2016-01-01 1-Jan-16 Diane Television Y Y
32 ID0033 2016-01-01 1-Jan-16 Diane Air Conditioner Y Y
... ... ... ... ... ... ... ...
1736 ID1737 2016-01-31 31-Jan-16 Diane Toaster Y Y
1752 ID1753 2016-01-31 31-Jan-16 Diane Air Conditioner Y Y
1753 ID1754 2016-01-31 31-Jan-16 Diane Television Y Y
1755 ID1756 2016-01-31 31-Jan-16 Diane Television Y Y
1769 ID1770 2016-01-31 31-Jan-16 Diane Toaster Y Y