AnalystPath

Lyft Drivers at Salary Extremes

PandasEasyJunior levelLyft~15 min

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_idnamemonthly_earnings
1Alice60000
2Bob25000
3Carol15000
4Dave55000
5Eve30000

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 drivers

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