Part I — Markets and attention over time · Chapter 1
How New York's ride market changed
Seventeen years of TLC trip files show yellow cabs peaking in 2012, app rides passing cabs in 2017, and the cab trips that remain moving out of the small hours and getting longer. Which of those changes are in the world, and which are in the records, is part of the question.
New York's Taxi and Limousine Commission (TLC) publishes one parquet file per month for each kind of licensed ride: yellow cabs since 2009, green cabs since 2014, other for-hire vehicles since 2015, and the high-volume app companies (Uber, Lyft, Via, Juno) since February 2019. Together that is 594 files, 4.40 billion rows and 81 GB of parquet.
How did the size and make-up of New York's recorded ride market change over those seventeen years, and what changed about the trips still taken in yellow cabs? Three things are easy to blur here: how many trips there were, each service's share of them, and what the files happened to record. App companies' trips sit unnamed inside other files until 2019, so the crossover from cabs to apps cannot be read from the trip files alone. The trip-level comparisons use April of every year, the one month published in every year, and flag implausible trips rather than delete them. The last sections show how the pipeline reads the files in place and how far its counts agree with TLC's own.
Monthly yellow-cab trips peaked in March 2012; Uber and Lyft now carry most rides
Querychapters/01-nyc-rides/pipeline/20_model.sqlShow SQL
CREATE OR REPLACE TABLE monthly_trips AS
SELECT strptime(ym, '%Y-%m')::DATE AS month, service,
CASE service WHEN 'yellow' THEN 'Yellow cab' WHEN 'green' THEN 'Green cab'
WHEN 'fhv' THEN 'Other FHV' END AS series,
num_rows AS trips
FROM file_meta WHERE service <> 'fhvhv'
UNION ALL
SELECT strptime(ym, '%Y-%m')::DATE, 'fhvhv', hv_company(hvfhs_license_num), sum(trips)
FROM hv_company_monthly GROUP BY ALL;728 rows · 20_model.sql ran in 10 sRuns at build time in DuckDB 2.0; shown for reading.Open file
Monthly yellow-cab trips peaked at 16.1 million trips in March 2012. In August 2026, the newest month published, they carried 3.3 million, while Uber carried 14.8 million and Lyft 5.7 million. In July 2026, the newest month with files for all four services, Uber and Lyft carried 78.6% of all trips.
What the files record
For a check against an outside figure, the pipeline also reads two of TLC's own monthly aggregates from NYC Open Data: the Industry Indicators (trips per day by licence class) and the FHV Base Aggregate Report (trips per dispatching base, which names Uber from January 2015, Lyft and Via from April 2015 and Juno from March 2016).
App rides overtook cabs in 2017
The high-volume files only start in February 2019, and by then app rides were already far ahead: 20.2 million trips that month against 7.7 million for yellow and green cabs together. For the crossover itself the pipeline uses TLC's FHV Base Aggregate Report, which lists the four companies as bases (Juno from March 2016). Their combined dispatched trips first exceeded cab trips in February 2017: 10.24 million against 10.19 million. That is before the months in which the green files run above TLC's own counts (from August 2018), so those do not move the crossover.
Uber, Lyft, Via and Juno passed yellow and green cabs combined in February 2017
The COVID-19 shutdown cut both, cabs harder. Yellow and green cabs went from 8.0 million trips in April 2019 to 273,717 in April 2020; app rides went from 21.7 million to 4.3 million.
Yellow cabs lost their late nights
The grid shows each weekday-hour's share of the week's valid trips in April. Switch services and years to compare; the third panel is the change in percentage points.
Yellow-cab trips moved away from the small hours
In April 2009, 11.6% of yellow-cab trips started between midnight and 5 a.m.; in April 2026 it was 7.7%. The app companies kept more of the night: 10.6% of their April 2026 trips started in those hours. The data shows where cab trips went missing; it does not show why, and riders switching to apps is one reading among several (fewer cabs on the road at night is another).
Trips got longer
Average yellow-cab trips grew longer in both miles and minutes
Miles per trip
Minutes per trip
The average April yellow-cab trip went from 2.7 miles and 11.9 minutes in 2009 to 3.5 miles and 18.1 minutes in 2026. Uber trips in April 2026 averaged 4.9 miles and 19.7 minutes.
How much the validity filters drop
Recent yellow files fail the validity filters more often than older ones
In April 2026, 4.1% of yellow rows failed a filter, mostly zero or implausible distance (2.4%) and duration (1.3%). In April 2009 the share was 1.0%. The high-volume files are cleaner: 0.04% of April 2026 rows failed.
Checking the counts against TLC
checks.sql stops the run if any check fails, and 22 of 22 passed. Row counts are compared at every stage, and selected months from 2010 to 2026 are compared with TLC's own published figures, counting trips whose pickup falls inside the file's month less the records named below; the charts show all file rows. Of the 352 yellow and green months TLC reports, 76 differ from the file by more than 1%, and a check fails the run if any of them falls outside the ranges listed under Caveats.
Two of those gaps have an explanation in the files. For April 2026 the yellow file has 3,831,240 rows, 4.1% more than TLC's figure of 3,681,990. Pickups from other months and duplicate rows account for almost none of it (40 duplicates in the three files examined). The excess is records with rate code 99, "unknown" in TLC's data dictionary: without them the count is within 0.09% of TLC's, and against TLC's zone-level report each such record accounts for 0.995 trips of a zone's excess. By July 2026 TLC's figures include them. In the same way, the green files from August 2018 to December 2019 hold a block of records with no rate code that TLC's figures leave out; without them all 17 months reconcile. TLC has published neither rule. The pipeline README traces both.
Where the file counts and TLC's published figures disagree, and why
| all_checks_ran | 21 | 21.000 | — | — | yes |
| base_lyft_2023_04 | 5,146,490 | 5,146,490.000 | 5,146,490 | 0.00% | yes |
| base_uber_2019_10 | 14,509,882 | 14,509,894.000 | 14,509,894 | 0.00% | yes |
| base_uber_2026_04 | 15,378,858 | 15,378,858.000 | 15,378,858 | 0.00% | yes |
| check_counts_rows | 240,446,672 | 240,446,672.000 | — | 0.00% | yes |
| duplicates_vs_gap | 0 | 40.000 | 5,018,422 | 0.04% | yes |
| files_inventoried | 594 | 594.000 | — | — | yes |
| hv_split_rows | 1,648,689,733 | 1,648,689,733.000 | — | 0.00% | yes |
| local_copy_rows | 26,826,686 | 26,826,686.000 | — | 0.00% | yes |
| release_green_2018_10 | 710,482 | 709,564.000 | 731,888 | 0.13% | yes |
| sample_cells_rows | 365,576,015 | 365,576,015.000 | — | 0.00% | yes |
| tlc_gaps_documented | 0 | 0.000 | — | — | yes |
Explore seventeen years of rides yourself
The dashboard below runs the chapter's data in your browser. The pipeline's live step (91_export_live.sql) reduces the April file of every service and year to four small tables (trips by weekday and hour, by pickup zone and dropoff borough, and by trip length, plus a row per April), and adds the monthly counts charted above: 2.0 MB on public storage. DuckDB-Wasm reads them over HTTP range requests, so a filter fetches only the row groups it needs. Pick an April and a service and every panel is recomputed; each shows its SQL. The Ask box at the bottom hands your question to an AI model that writes the SQL; the query runs here, on the same files, and the model only sees the small result. Its answers are live and unaudited, unlike the numbers above.
Live · runs in your browser
New York taxi and app rides, 2009 to 2026
- Engine
- DuckDB 2.0.1 · Wasm
- Data read
- 0 B of 1.9 MB
The chapter's data sits in 5 Parquet files on public storage, 1.9 MB in all. Start the engine and DuckDB runs inside this page: each chart below is a SQL query that reads only the row groups and columns it needs over HTTP range requests.
monthlyTrips per month by service, 2009 to 2026yearsApril of each year by service: trips, miles, minutes, fareshoursApril trips by year, service, weekday and hourzonesApril trips by year, service, pickup zone and dropoff boroughlengthsApril trips by year, service and trip length (miles, minutes)
Queries this chapter's published snapshot; the data does not update in real time. No account, nothing uploaded.
How the pipeline reads the files in place
The pipeline is five SQL files run in order against one DuckDB database file. Only 10_stage.sql touches the network. A full run took 38 minutes and downloaded 9.0 GB in 2,421 HTTP GET requests, range reads and report downloads together, on a 4-core cloud container with DuckDB capped at two threads and 2.5 GB of memory.
Build the URL list
HTTPS has no directory listing, so a glob such as
yellow_tripdata_*.parquetcannot work. The pipeline builds every file name from the month instead:range()over timestamps gives one value per month, and a lambda formats each into a URL.00_sources.sqlSQL CREATE OR REPLACE MACRO tlc_urls(svc, first_month, last_month) AS list_transform( range(first_month::TIMESTAMP, last_month::TIMESTAMP + INTERVAL 1 MONTH, INTERVAL 1 MONTH), lambda m: printf('https://d37ci6vzurychx.cloudfront.net/trip-data/%s_tripdata_%s.parquet', svc, strftime(m, '%Y-%m'))); CREATE OR REPLACE VIEW tlc_files AS SELECT service, regexp_extract(url, '(\d{4}-\d{2})\.parquet$', 1) AS ym, url FROM services, unnest(tlc_urls(service, first_month, last_month)) AS u(url);594 URLs · no network · under 0.1 schapters/01-nyc-rides/pipeline/00_sources.sql
Reconcile seventeen years of schemas
Column names drift: the 2009 yellow files say
Trip_Pickup_DateTime(text), 2010 sayspickup_datetime, and from 2011 it istpep_pickup_datetime(a timestamp).union_by_name = truelines files up by column name, case-insensitively, and fills NULL where a file lacks a column;coalescethen folds the spellings into one.10_stage.sqlSQL SELECT 'yellow' AS service, strftime(file_month(filename), '%Y-%m') AS ym, coalesce(tpep_pickup_datetime, TRY_CAST(pickup_datetime AS TIMESTAMP), TRY_CAST(Trip_Pickup_DateTime AS TIMESTAMP)) AS pickup_at, date_diff('second', pickup_at, coalesce(tpep_dropoff_datetime, TRY_CAST(dropoff_datetime AS TIMESTAMP), TRY_CAST(Trip_Dropoff_DateTime AS TIMESTAMP))) AS duration_s, Trip_Distance AS distance_mi, coalesce(fare_amount, Fare_Amt) AS fare FROM read_parquet(getvariable('r_yellow'), union_by_name = true, filename = true) WHERE list_contains(getvariable('b_yellow'), filename)Every column the SELECT names must exist in at least one file of the list, so each batch carries one small "anchor" file per column name; the
filenamefilter keeps DuckDB from scanning them. The trip-level steps use April of every year, the one month published in every year from 2009 to 2026, and check that the rows aggregated from each April file equal its footer count (366 million rows).366 million rows from the April files, every one accounted for · 47 s of querieschapters/01-nyc-rides/pipeline/10_stage.sql
Flag invalid trips instead of deleting them
Each trip gets a flag value built from bits: pickup outside the file's month, duration of zero or over four hours, distance of zero or over 100 miles, negative fare. Aggregating to service × weekday × hour × flags keeps every row countable while dropping the trip-level detail.
10_stage.sqlSQL CREATE OR REPLACE MACRO trip_flags(pickup_at, month_start, duration_s, distance_mi, fare) AS CASE WHEN pickup_at IS NULL OR date_trunc('month', pickup_at) <> month_start THEN 1 ELSE 0 END + CASE WHEN duration_s <= 0 OR duration_s > 4 * 3600 THEN 2 ELSE 0 END + CASE WHEN distance_mi <= 0 OR distance_mi > 100 THEN 4 ELSE 0 END + CASE WHEN fare < 0 THEN 8 ELSE 0 END;One bit per filter; the same 366 million rows, aggregated in the step abovechapters/01-nyc-rides/pipeline/10_stage.sql
Keep a local copy of one month
Exploring one month repeatedly over HTTPS repeats the downloads.
COPY … (PARTITION_BY …)writes the valid April 2026 trips toout/april_2026/service=…/, andSUMMARIZEthen profiles every column with no network traffic. A check confirms the copy matches the remote counts cell by cell.10_stage.sqlSQL COPY ( SELECT service, company, pickup_at, duration_s, distance_mi, fare FROM recon WHERE trip_flags(pickup_at, DATE '2026-04-01', duration_s, distance_mi, fare) = 0 ) TO '../out/april_2026' (FORMAT parquet, COMPRESSION zstd, PARTITION_BY (service), OVERWRITE_OR_IGNORE true);26.8 million valid trips from April 2026, hive-partitioned by service · 6 schapters/01-nyc-rides/pipeline/10_stage.sql
What projection and filter pushdown save
DuckDB reads a remote parquet file with HTTP range requests and fetches only the column chunks a query needs. The pipeline measured this on the April 2026 yellow file (3,831,240 rows) with HTTP logging on and every cache off.
A query that names one column downloads a small fraction of the file
| count(*) only | 1 | 65.5K | 3831240 |
| one column | 5 | 5.4M | 5.18 |
| one column + filter on pickup time | 5 | 10.2M | 4.754 |
| every column | 5 | 64.9M | 1842120001 |
count(*) read 64 KB: the footer alone. One column took 5.4 MB and every column 64.9 MB. Across the April files the trip-level step reads, the columns it names are 44% of the bytes: 33% for the high-volume files and 52% for yellow.
Reusing the approach
Any public dataset published as one file per period over plain HTTPS can be read the same way:
- Build the URL list in SQL from the period, since HTTPS cannot be globbed.
- Inventory the files from their footers first. Row counts, schemas and column sizes cost a few kilobytes per file and tell you what the full read will cost.
- Read with
union_by_name = trueandcoalescethe spellings; keep one anchor file per column name in the list so every name binds. - Name only the columns you need, and count what you drop instead of silently filtering it.
SET VARIABLE urls = list_transform(
range(TIMESTAMP '2024-01-01', TIMESTAMP '2025-01-01', INTERVAL 1 MONTH),
lambda m: printf('https://example.org/data/records_%s.parquet', strftime(m, '%Y-%m')));
-- Footers only: rows and bytes per file, no data read.
SELECT file_name, num_rows, file_size_bytes FROM parquet_file_metadata(getvariable('urls'));
-- The columns you need, across schema changes.
SELECT filename, count(*) AS rows, avg(coalesce(new_name, old_name)) AS value
FROM read_parquet(getvariable('urls'), union_by_name = true, filename = true)
GROUP BY ALL;cd chapters/01-nyc-rides/pipeline
uv venv && uv pip install duckdb==2.0.0
python -I run.py # 00_sources → 10_stage → 20_model → 90_export → checksrun.py re-runs the resumable fetch step until it finishes and backs off when the CDN refuses requests. The full run here took 38 minutes and downloaded 9.0 GB; most of that time is pacing to stay under the CDN's request limit. The page reads 1.3 MB of JSON. The full pipeline and its README, including how the two count gaps were traced, are in the pipeline folder.