Drivers With Low or No Tips
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_id | name | city |
|---|---|---|
| 3 | Omar | Haifa |
| 1 | Lea | Acre |
| 2 | Dana | Acre |
| 4 | Yossi | Eilat |
| driver_id | amount |
|---|---|
| 2 | 8 |
| 4 | 35 |
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 driverSolve 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