AnalystPath

Drivers With Low or No Tips

PandasEasyJunior level~10 min

Problem

You are given two DataFrames.

`driver`
```text
+-----------+--------+
| Column | Type |
+-----------+--------+
| driver_id | int |
| name | object |
| city | object |
+-----------+--------+
```

`tip`
```text
+-----------+--------+
| Column | Type |
+-----------+--------+
| driver_id | int |
| amount | int |
+-----------+--------+
A driver may have no tip row at all.
```

Report every driver whose tip `amount` is **below 20**, as well as every driver who received no tip at all. Return a DataFrame with columns `name`, `amount` (the amount is missing for untipped drivers). Result order does not matter.

Input data

Example rows — the live problem includes the full dataset.

driver
driver_idnamecity
3OmarHaifa
1LeaAcre
2DanaAcre
4YossiEilat
tip
driver_idamount
28
435

Expected output

Your answer should return 3 rows with the columns name, amount.

Starter code (Pandas (Python))

import pandas as pd

def low_tips(driver: pd.DataFrame, tip: pd.DataFrame) -> pd.DataFrame:
    # Your code here
    return driver

Solve this Pandas question free

Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related Pandas questions