question 445 Data Formats & Analytical Workflows · medium
Busy pickup zones with DuckDB
Write busy_zones(trips, zones, min_trips): with one DuckDB query over the two DataFrames, return a DataFrame with zone_name, trips and avg_fare (mean fare_amount, rounded to 2 decimals) for pickup zones with at least min_trips trips, ordered by trips (most first), then zone_name. Only zones listed in zones appear.
Function
busy_zones(trips, zones, min_trips)Returnsa DataFrame with columns
zone_name, trips, avg_fare