0

I have a dataset for call centers and while we calculate staff KPIs, staff who have better numbers for AHT(average handling time), give him 10 points extra.

I am doing the same in excel by using IF function but I want to do it in pandas because it is reparative weakly for my reports.

I tried to apply the below function but I couldn't

df['AHT']
0       350.224490
1       546.105263
2       301.400000
3       567.956522
4              NaN
      ...     
545    1039.409091
546            NaN
547     537.000000
548    1088.600000
549     733.156537
Name: AHT, Length: 550, dtype: float64

def aht_point(aht):
    if df['AHT'] == 490.0:
        df['Qpoints'] = 0
    elif df['AHT'] < 490.0:
        df['Qpoints'] = 10
    elif df['AHT'] > 490.0:
        df['Qpoints'] = 10
return aht

df['AHT'].apply(lambda x:x.aht_point)
---------------------------------------------------------------------------
AttributeError: 'float' object has no attribute 'aht_point'

0 Answers0