Airbnb Popularity Bucket Pricing
Problem
**[Asked at Airbnb]**
Bucket listings by `reviews_count` into three popularity tiers:
- **Few**: 0-10 reviews
- **Some**: 11-50 reviews
- **Many**: 51+ reviews
For each bucket, return `min_price`, `max_price`, and `mean_price`.
Order: Few, Some, Many (use `pd.cut` with these bins).
Input data
Example rows — the live problem includes the full dataset.
listings
| listing_id | city | price | reviews_count |
|---|---|---|---|
| 1 | NY | 200 | 5 |
| 2 | NY | 300 | 50 |
| 3 | LA | 150 | 15 |
| 4 | LA | 250 | 100 |
| 5 | Chicago | 180 | 200 |
Expected output
Your answer should return 3 rows with the columns bucket, min_price, max_price, mean_price.
Starter code (Pandas (Python))
import pandas as pd
def popularity_pricing(listings: pd.DataFrame) -> pd.DataFrame:
# Your code here
return listingsSolve 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