
Listings missing a price
easyListings missing a price
Zillow Pandas Interview Question
Zillow's data quality team is chasing listings that were published without a price. The report must still show cities that have no such listings.
Using the listings DataFrame, find each city and the number of its listings with no list price as missing_prices. Cities where every listing has a price should show 0. Assign the answer to result.
Asked of
- Data Analyst
- Product Analyst
- Business Analyst
- Analytics Engineer
- Data Scientist
listingsDataFrame16 rows
| Column Name | Type |
|---|---|
| listing_id | int64 |
| city | str |
| bedrooms | int64 |
| square_feet | int64 |
| list_price | float64 |
| listed_date | str |
| status | str |
listingsExample Input
| listing_id | city | bedrooms | square_feet | list_price | listed_date | status |
|---|---|---|---|---|---|---|
| 30001 | Seattle | 3 | 1850 | 925000 | 2024-04-01 | active |
| 30002 | Seattle | 2 | 1100 | NULL | 2024-04-02 | active |
| 30003 | Denver | 4 | 2400 | 780000 | 2024-04-02 | pending |
| 30004 | Austin | 3 | 1700 | NULL | 2024-04-03 | active |
| 30005 | Denver | 2 | 1050 | NULL | 2024-04-04 | active |
| 30006 | Austin | 4 | 2600 | 640000 | 2024-04-05 | sold |
| 30007 | Seattle | 1 | 720 | NULL | 2024-04-05 | active |
| 30008 | Phoenix | 3 | 1600 | 455000 | 2024-04-06 | active |
Example Output
| city | missing_prices |
|---|---|
| Austin | 1 |
| Denver | 1 |
| Phoenix | 0 |
| Seattle | 2 |
Explanation
In the example, Seattle has two listings with no price, and Denver and Austin have one each. Phoenix has one listing and it has a price, so Phoenix still appears, with 0.
The example above is a small slice of the data. Your code runs against the full DataFrames.
Company
Zillow
Difficulty
easy
Topic
null handling
Language
Pandas
Your code
Loading Python in the background. You can start writing.