I have a dataframe as shown below. Which is a doctors booking data.
Doctor Appointment Show
A 2020-01-18 12:00:00 Yes
A 2020-01-18 12:30:00 Yes
A 2020-01-18 13:00:00 No
A 2020-01-18 13:30:00 Yes
B 2020-01-18 12:00:00 Yes
B 2020-01-18 12:30:00 Yes
B 2020-01-18 13:00:00 No
B 2020-01-18 13:30:00 Yes
B 2020-01-18 16:00:00 No
B 2020-01-18 16:30:00 Yes
A 2020-01-19 12:00:00 Yes
A 2020-01-19 12:30:00 Yes
A 2020-01-19 13:00:00 No
A 2020-01-19 13:30:00 Yes
A 2020-01-19 14:00:00 Yes
A 2020-01-19 14:30:00 No
A 2020-01-19 16:00:00 No
A 2020-01-19 16:30:00 Yes
B 2020-01-19 12:00:00 Yes
B 2020-01-19 12:30:00 Yes
B 2020-01-19 13:00:00 No
B 2020-01-19 13:30:00 Yes
B 2020-01-19 14:00:00 No
B 2020-01-19 14:30:00 Yes
B 2020-01-19 15:00:00 No
B 2020-01-18 15:30:00 Yes
From the above dataframe I would like to create a function in pandas, which will output the following.
I tried below
def Doctor_date_summary(doctor, date):
Number of slots = df.groupby([doctor, date] ).sum()
Expected Output:
Doctor_date_summary(Doctor, date)
If Doctor = A, date = 2020-01-19
Number of slots = 8
Number of show up = 5
show up percentage = 62.5
where number of Yes = 5 in show column on that date for that docto