Lyft Drivers at Salary Extremes
Problem
**[Asked at Lyft]**
Find drivers whose `monthly_earnings` is either **above $50 000** OR **below
$20 000** (the high and low extremes).
Return all columns, ordered by `monthly_earnings` descending.
Input data
Example rows — the live problem includes the full dataset.
drivers
| driver_id | name | monthly_earnings |
|---|---|---|
| 1 | Alice | 60000 |
| 2 | Bob | 25000 |
| 3 | Carol | 15000 |
| 4 | Dave | 55000 |
| 5 | Eve | 30000 |
Expected output
Your answer should return 4 rows with the columns driver_id, name, monthly_earnings.
Starter code (Pandas (Python))
import pandas as pd
def salary_extremes(drivers: pd.DataFrame) -> pd.DataFrame:
# Your code here
return driversSolve 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