I was tring to apply a function on my dataframe adding information regarding the average performance of each id i have. the problem is that applying this function using apply takes a lot of time (i stopped the process after 20 minuts) and i need to do it a few times over. so i thought to try taking out the information to a new data frame and then merge the two together. The problem is my new dataframe has multyindex and i'm trying to merge on that index. can't seem to find the way to do it. any suggestions?
the new data frame look like this:
compliance_detail
inspector_name compliance
Addison, Michael 0.0 0.431203
1.0 0.034050
Ahmad, Muna I 0.0 0.731405
1.0 0.052342
Anderson, Trevis 0.0 0.166667
and i want to merge on the inspector's name and compliance since i have this two in my original data frame.
i want the merged data frame to have for every inspector his rating for complaince==0 and complaince==1. so it will look something like this:
ticket_id inspector_name positive_complaince negetive_complaince
0 22056 Addison, Michael 0.034050 0.431203
1 22057 Ahmad, Muna I 0.052342 0.731405