Skip to content

NYC Taxi — Tip Analysis

NYC Taxi benchmark · all NYC Taxi queries

Tip patterns by time and location

Representative SQL

Rendered in the benchmark’s native SQL with default parameters (no dialect translation available).

SELECT
EXTRACT(HOUR FROM pickup_datetime) AS hour,
COUNT(*) AS trip_count,
AVG(tip_amount) AS avg_tip,
AVG(CASE WHEN fare_amount > 0 THEN tip_amount / fare_amount * 100 END) AS avg_tip_pct
FROM trips
WHERE
pickup_datetime >= '2019-07-07'
AND pickup_datetime < '2019-08-06'
AND payment_type = 1
GROUP BY
EXTRACT(HOUR FROM pickup_datetime)
ORDER BY
hour

Representative DataFrame

No DataFrame implementation is registered for this query.

Get the exact query for your run

The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:

from benchbox import NYCTaxi
bench = NYCTaxi(scale_factor=1.0) # your scale factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['tip-analysis'])

Source

Query text: benchbox/core/nyctaxi/queries.py