Question: 1 . 4 . Problem 4 Let's assume that there are two service periods: Service Period 1 consists of time slots 1 7 : 3
Problem
Let's assume that there are two service periods:
Service Period consists of time slots ::::
Service Period consiss of time slots ::::
The purpose of this question is find out how popular a particular dining time is within its own service period The way we are going to go about this is to find out the "rank" of a dining time amoung all other bookings received on each day. To make the idea clear, consider dining time : If everyday the first booked reservation is for :ie it has rank then : is quite popular. On the other hand, if : is always the last dining time booked by customers on each day, it means that it is not that popular perhaps it was booked because all other dining times were already booked by other customers You are going to implement this idea in the next function.
The next function takes as input restime, which is one of the eight times above as a datetime time. Given the inputted time, you will exclusively focus this analysis on either Service Period or For example, if the inputted restime is : you should only consider reservations made during Service Period For each day, find the first reservation that books at restime datetimebooked tells you the order in which reservations were scheduled Within the given Service Period of interest, compute how many reservations have already been booked on that day before this reservation was made for restime. If k reservations have already been made, this means that restime was the kth reservation that was booked on that day. We will say the "rank" of reservation time restime on that day was k So if restime was the first time booked on a particular day for the relevant Service Period, its rank on that day is Return the average rank of restime across all days in which a reservation for restime was booked.
Notice: If there are two reservation which have the same booking time, they will have the same rank. For example, in the following table, both the first and second row counting rows from zero share Rank
reservationdatreservationtimedatetimebookedrank::::::::::::::::
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
