Prepare Taxi Driver Classification Data
Updated
Problem statement
Prepare train_drivers and test_drivers for a binary driver-classification task. Return both transformed datasets in one table, with all training rows first and all test rows second. Add dataset as the first column, using "train" or "test".
- Compute the mean non-null training
age. Fill missing ages in both datasets with that mean, then truncate every age to an integer. - For
car_modelandsecond_language, sort the distinct training strings in ascending order and encode them as0,1, and so on. Encode any value not seen in training as-1. - Compute the training mean and population standard deviation of
net_worth_of_tips. Standardize that column in both datasets with those training statistics and round it to five decimal places. If the training standard deviation is0, return0for every standardized tip value. - Encode
"A class"as0and"B class"as1. Preserve a null test label as null.
Keep all other values unchanged and return the declared columns in order.
Table schema
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
train_drivers
Labeled training driver features.
| Column | Type | Nullable | Description |
|---|---|---|---|
| driver_idPK | Integer | No | — |
| car_model | Text | No | — |
| car_manufacture_year | Integer | No | — |
| days_since_inspection | Integer | No | — |
| age | Integer | Yes | — |
| experience | Integer | No | — |
| second_language | Text | No | — |
| rating | Decimal | No | — |
| net_worth_of_tips | Decimal | No | — |
| number_of_rejected_rides | Integer | No | — |
| number_of_upvotes | Integer | No | — |
| number_of_complaints | Integer | No | — |
| number_of_incidents | Integer | No | — |
| driver_class | Text | Yes | — |
test_drivers
Driver features to transform with training-only statistics.
| Column | Type | Nullable | Description |
|---|---|---|---|
| driver_idPK | Integer | No | — |
| car_model | Text | No | — |
| car_manufacture_year | Integer | No | — |
| days_since_inspection | Integer | No | — |
| age | Integer | Yes | — |
| experience | Integer | No | — |
| second_language | Text | No | — |
| rating | Decimal | No | — |
| net_worth_of_tips | Decimal | No | — |
| number_of_rejected_rides | Integer | No | — |
| number_of_upvotes | Integer | No | — |
| number_of_complaints | Integer | No | — |
| number_of_incidents | Integer | No | — |
| driver_class | Text | Yes | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| dataset | Text | No | — |
| driver_id | Integer | No | — |
| car_model | Integer | No | — |
| car_manufacture_year | Integer | No | — |
| days_since_inspection | Integer | No | — |
| age | Integer | No | — |
| experience | Integer | No | — |
| second_language | Integer | No | — |
| rating | Decimal | No | — |
| net_worth_of_tips | Decimal | No | — |
| number_of_rejected_rides | Integer | No | — |
| number_of_upvotes | Integer | No | — |
| number_of_complaints | Integer | No | — |
| number_of_incidents | Integer | No | — |
| driver_class | Integer | Yes | — |
Row order: must match exactly. Numeric tolerance: 0.00001.
Constraints
train_driversandtest_driversare both non-empty.- At least one training age is non-null.
- Training rows have
driver_classequal to"A class"or"B class". - Test labels may be null.
- Every numeric input is finite.
- Result row order is exact.
Source note: The source report requests processed_train.csv and processed_test.csv; this practice returns both splits in one table.
More Boston Consulting Group interview questions
- Build Taxi Driver Performance FeaturesOA · Seen Nov 2026
- Summarize Taxi Drivers and RidesOA · Seen Nov 2026
- Competition Winner and Runner-Up (Forward Deployed Engineer)OA · Seen Nov 2026
- Count Belt Sections With K Fruit Pairs (Forward Deployed Engineer)OA · Seen Nov 2026
- Robot Stops Left or Right (Forward Deployed Engineer)OA · Seen Nov 2026
- Split a Matrix Into Four Partitions by Average (Forward Deployed Engineer)OA · Seen Nov 2026
- Predict Taxi Driver ClassesOA · Seen Oct 2026
- Even-Position MonotonicityOA · Seen Jul 2026
- Shortest Distances From an Adjacency MatrixPHONE SCREEN · Seen Sep 2026
Similar questions at other companies
- Capping Portfolio WeightsCapstone Investment Advisors · OA
- Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
- Macaron Order PriceOpenAI · OAOpenAI interview questions
- Linear InterpolatorTwo Sigma · OATwo Sigma interview questions
- Sum of Pipeline Response TimesBloomberg LP · OABloomberg LP interview questions
- Clean the TapeMillennium · OAMillennium interview questions
- Return Exact Cash Register ChangeBank of America · OABank of America interview questions
- Product of Subset MaximaArcesium · OAArcesium interview questions
- REST API: Energy BarRippling · OARippling interview questions
- Paint the CeilingSnowflake · OASnowflake interview questions