Slow deliveries by cuisine

dates

Slow deliveries by cuisine

DoorDash Pandas Interview Question

DoorDash promises most orders within 30 minutes. The restaurant success team wants to know which cuisines miss that most often.

Use the deliveries and restaurants DataFrames and count delivered orders only. Return each cuisine with the number of delivered orders as delivered_orders and the percentage that took more than 30 minutes from order to delivery as slow_pct, rounded to 1 decimal place. Sort the rows by slow_pct, highest first. Assign the answer to result.

Asked of

  • Data Analyst
  • Product Analyst
  • Business Analyst
  • Analytics Engineer
  • Data Scientist

deliveriesDataFrame12 rows

Column NameType
delivery_idint64
restaurant_idint64
dasher_idint64
ordered_atstr
delivered_atstr
order_valuefloat64
statusstr

restaurantsDataFrame6 rows

Column NameType
restaurant_idint64
restaurant_namestr
cuisinestr
citystr

deliveriesExample Input

delivery_idrestaurant_iddasher_idordered_atdelivered_atorder_valuestatus
70011512024-04-12 11:58:002024-04-12 12:26:0032.4delivered
70022522024-04-12 12:05:002024-04-12 12:41:0027.8delivered
70033532024-04-12 12:20:00NULL18.5canceled
70044542024-04-12 18:02:002024-04-12 18:48:0045.6delivered
70055552024-04-12 18:15:002024-04-12 18:37:0022.1delivered
70061522024-04-12 18:30:002024-04-12 19:04:0041.25delivered
70076562024-04-12 19:10:002024-04-12 19:52:0036.9delivered

restaurantsExample Input

restaurant_idrestaurant_namecuisinecity
1Taco LocoMexicanSan Francisco
2Pho RealVietnameseSan Francisco
3Burger BarnAmericanSan Francisco
4Curry HouseIndianDenver
5Nacho MamaMexicanDenver
6Big Bite BurgersAmericanDenver

Example Output

cuisinedelivered_ordersslow_pct
American1100
Indian1100
Vietnamese1100
Mexican333.3

Explanation

Taco Loco and Nacho Mama both serve Mexican food. Their three deliveries took 28, 22 and 34 minutes, so one of the three was slow, which is 33.3%. Order 7003 was canceled, so it is not counted.

The example above is a small slice of the data. Your code runs against the full DataFrames.