Drivers without rides

joins

Drivers without rides

Uber Pandas Interview Question

Uber's driver onboarding team follows up with people who signed up to drive but have not given a ride yet.

Using the drivers and rides DataFrames, find every driver with no rides, showing their driver_id and driver_name. Assign the answer to result.

Asked of

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

driversDataFrame10 rows

Column NameType
driver_idint64
driver_namestr
vehicle_typestr
joined_datestr

ridesDataFrame20 rows

Column NameType
ride_idint64
driver_idint64
citystr
requested_atstr
farefloat64
ratingfloat64

driversExample Input

driver_iddriver_namevehicle_typejoined_date
305Elena PetrovaBlack2019-11-15
306Sam OkoyeUberX2022-07-30
307Priya IyerComfort2021-12-05
308Noah FischerBlack2020-05-22
309Jordan EllisUberX2024-02-14
310Carmen DiazBlack2023-10-01

ridesExample Input

ride_iddriver_idcityrequested_atfarerating
7001301Chicago2024-06-03 08:12:0018.45
7002302Chicago2024-06-03 08:40:0032.14
7003303Austin2024-06-03 09:05:0054.755
7004304Austin2024-06-03 09:30:0012.9NULL
7005301Chicago2024-06-03 11:15:0021.64
7006305Seattle2024-06-03 12:02:0087.25
7007306Seattle2024-06-03 12:45:0016.33
7008302Chicago2024-06-03 13:20:0027.8NULL
7009307Austin2024-06-03 14:10:00414
7010303Austin2024-06-03 15:35:0063.255
7011304Austin2024-06-03 16:05:0014.22
7012308Seattle2024-06-03 17:40:0095.64

Example Output

driver_iddriver_name
309Jordan Ellis
310Carmen Diaz

Explanation

Drivers 309 and 310 have no rides in the example, so they are returned. Drivers 305 to 308 each gave at least one ride, so they are left out.

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