FastPrepAnalyze House and Viewing Metrics

Analyze House and Viewing Metrics

Capital One logoCapital One● EasyFULLTIMEOA

Problem statement

Combine the four house partitions houses_0 through houses_3 and analyze them together with house_views.

Return exactly three rows with columns insight_type and value, in this order:

  1. average_house_price: the arithmetic mean of price across every house.
  2. percentage_waterfront_houses: the percentage of houses whose waterfront value is 1, on the 0-to-100 scale.
  3. average_views_per_viewed_house_last_30_days: use view dates from 2023-03-16 through 2023-04-15, inclusive; count views per house, then average those counts across houses with at least one qualifying view. Return 0 when no house has a qualifying view.

Table schema

Pandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

houses_0

One partition of the house catalog.

ColumnTypeNullableDescription
house_idPKIntegerNo—
bedroomsIntegerNo—
bathroomsDecimalNo—
sqft_livingIntegerNo—
sqft_lotIntegerNo—
floorsDecimalNo—
waterfrontIntegerNo—
ageIntegerNo—
priceDecimalNo—

houses_1

One partition of the house catalog.

ColumnTypeNullableDescription
house_idPKIntegerNo—
bedroomsIntegerNo—
bathroomsDecimalNo—
sqft_livingIntegerNo—
sqft_lotIntegerNo—
floorsDecimalNo—
waterfrontIntegerNo—
ageIntegerNo—
priceDecimalNo—

houses_2

One partition of the house catalog.

ColumnTypeNullableDescription
house_idPKIntegerNo—
bedroomsIntegerNo—
bathroomsDecimalNo—
sqft_livingIntegerNo—
sqft_lotIntegerNo—
floorsDecimalNo—
waterfrontIntegerNo—
ageIntegerNo—
priceDecimalNo—

houses_3

One partition of the house catalog.

ColumnTypeNullableDescription
house_idPKIntegerNo—
bedroomsIntegerNo—
bathroomsDecimalNo—
sqft_livingIntegerNo—
sqft_lotIntegerNo—
floorsDecimalNo—
waterfrontIntegerNo—
ageIntegerNo—
priceDecimalNo—

house_views

House-view events; one viewer may view the same house more than once.

ColumnTypeNullableDescription
viewer_idIntegerNo—
house_idIntegerNo—
view_dateDateNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
insight_typeTextNo—
valueDecimalNo—

Row order: must match exactly. Numeric tolerance: 1e-9.

Constraints

  • At least one house exists across the four partitions.
  • house_id values are unique across all four house partitions.
  • waterfront is 0 or 1.
  • Every price is finite and nonnegative.
  • Every view_date is a valid ISO calendar date.
  • Result row order is exact.

Source note: Original Capital One data-science assessment task (carousel slide 1).

More Capital One problems

See Capital One hiring insights