Listings missing a price

null handling

Listings 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 NameType
listing_idint64
citystr
bedroomsint64
square_feetint64
list_pricefloat64
listed_datestr
statusstr

listingsExample Input

listing_idcitybedroomssquare_feetlist_pricelisted_datestatus
30001Seattle318509250002024-04-01active
30002Seattle21100NULL2024-04-02active
30003Denver424007800002024-04-02pending
30004Austin31700NULL2024-04-03active
30005Denver21050NULL2024-04-04active
30006Austin426006400002024-04-05sold
30007Seattle1720NULL2024-04-05active
30008Phoenix316004550002024-04-06active

Example Output

citymissing_prices
Austin1
Denver1
Phoenix0
Seattle2

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.