How to calculate Value in (%) and than create new column with percentage of used time. (Python)

Alla Perlova perlovaa at gmail.com
Fri Jun 16 09:17:15 EDT 2017


Dear folks, I need some help with:
 
I am working with some Hospital data, and I need to calculate Operating Room Utilization per day

df.groupby(by = ['Actual_Surgery_Day','Actual_Surgery_Room']) .agg({'Actual_Surgery_Duratation' : 'sum', 'Procedure_Code' : 'count'})

		                                                                           Actual_Surgery_Duratation	     Procedure_Code
                                                                                                         609.0                                         10
                                                                                                         561.0                                           7
                                                                                                         704.0                                           5

Actual_Surgery_Day	Actual_Surgery_Room
	
                                                20001
                                                20002
                                                20003
                                                ..........
                                                20016
2016-01-08


So, I need to calculate a simple following equation **Z=960-x-18(y-1)**

960 min  = optimal time (in min) Room Utilization per day

x = Time for all procedures per Day; column - (Actual_Surgery_Duratation)

y = Procedure (amount per day in each Room (- 1), first case);  column - (Procedure_Code)

18 min = break time between each procedure 

How do I  calculate Room Utilization in %?

**Example**,first row table:

z=960-x-18(10-1)
z=960 min (wanted time) - 609 min  (actual time) - 162 (breaktime)
z=189 min time not used

What is the percentage of used time? in % (960 min - 189 min)

I appreciate any help.
Alla



More information about the Python-list mailing list