AnalystPath

Airbnb Popularity Bucket Pricing

PandasMediumMid levelAirbnb~15 min

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_idcitypricereviews_count
1NY2005
2NY30050
3LA15015
4LA250100
5Chicago180200

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 listings

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