Skip to content
TAXI NYC ’19, home

Optional

AI settings

Everything on this site works without AI. To try “Ask the data”, paste your own API key. Your browser sends it straight to the provider you pick. It is never sent to this site's server, never logged, and calls are billed to your account.

Provider
AI provider

Default. Cheapest and fastest; $1 / $5 per million input / output tokens.

No key saved for this provider. Create one at platform.claude.com. A key with a low spending limit is a good idea.

Data-quality rules

Every 2021 cleaning rule with its reason, rows removed in sequence, rows failing it on its own and rows failing only it.

dq_rules, page 1 of 1
stepINTEGERkeyTEXTstageTEXTlabelTEXTruleTEXTreasonTEXTapplied_toTEXTapplied_rowsINTEGERremoved_in_sequenceINTEGERfails_aloneINTEGERfails_only_thisINTEGER
1dropnaRound 1Drop rows with any missing valuedropna()The 2021 model needs every field. TLC left congestion_surcharge empty until 21 January 2019, so this one rule removes almost all of 1-20 January.raw8459844453006015300601null
2r1_1Round 1Trip distance must be positivetrip_distance > 0A metered trip cannot cover zero or negative distance: these are cancelled rides, meter tests or voids.dropna79297843705218705218508124
3r1_2Round 1Passenger count between 1 and 6passenger_count BETWEEN 1 AND 6Drivers enter the passenger count by hand; 0 means it was not entered, and a yellow cab seats at most 5 adults plus a child.dropna79297843143124514543471422874
4r1_3Round 1Known rate code (drops 99)RatecodeID BETWEEN 1 AND 6TLC's data dictionary defines rate codes 1-6; 99 is an undocumented placeholder.dropna79297843180337261767
5r1_4Round 1Fare must be positivefare_amount > 0Negative fares are reversals of an earlier charge, logged as separate rows; zero fares are not paid trips.dropna79297843156428197991359
6r1_5Round 1Extra charge cannot be negativeextra >= 0Negative extras are reversals, like negative fares.dropna7929784360080325135
7r1_6Round 1MTA tax of $0.50 to $1mta_tax BETWEEN 0.5 AND 1Every metered trip in New York City pays the $0.50 MTA state surcharge; other values are reversals or out-of-city trips.dropna79297843306307644160304423
8r1_7Round 1Tolls cannot be negativetolls_amount >= 0Negative tolls are reversals.dropna79297843035790
9r1_8Round 1Improvement surcharge equals $0.30improvement_surcharge = 0.30The $0.30 improvement surcharge applied to every trip in 2019.dropna7929784378482169837848
10r1_9Round 1Total amount must be positivetotal_amount > 0A trip with a non-positive total is a reversal or a void.dropna7929784301844550
11r1_10Round 1Congestion surcharge cannot be negativecongestion_surcharge >= 0Negative congestion surcharges are reversals.dropna7929784301195400
12r1_11Round 1Pickup between 2018-01-01 and 2019-12-31pickup_dt BETWEEN TIMESTAMP '2018-01-01 00:00:00' AND TIMESTAMP '2019-12-31 23:59:59'Meter clocks occasionally report years like 2003 or 2088. The notebook's window starts in 2018, a year early; the weather join later drops 2018 pickups anyway.dropna7929784396510100
13r1_12Round 1Drop-off within 2019dropoff_dt BETWEEN TIMESTAMP '2019-01-01 00:00:00' AND TIMESTAMP '2019-12-31 23:59:59'Drop-offs must fall in the year being studied.dropna79297843115021911150
14r1_13Round 1Drop unknown vendor 4VendorID != 4Vendor 4 does not appear in TLC's 2019 data dictionary (1 = Creative Mobile Technologies, 2 = VeriFone).dropna79297843197472199180197472
15fare_zscoreRound 2Fare z-score at most 3fare_amount <= 296.14325468838814Fares more than three standard deviations above the mean are treated as keying errors. The standard deviation is inflated by fares up to $671,123, so the cut-off ends up at about $296.round176488807747747617
16dedupRound 2Drop exact duplicate rowsSELECT DISTINCT *Identical rows in every field are double submissions from the meter.zscore764880603nullnull
17min_fareRound 3Fare at least $2.50fare_amount >= 2.5$2.50 was the flag-drop charge in 2019, so a metered fare cannot be lower.round176488807351351311
18positive_durationRound 3Drop-off after pick-uptravel_time > 0A trip that ends before it starts is a clock error.round17648880731843184945
19speedRound 3Distance / minutes at most 50trip_distance / travel_time <= 50Meant to remove trips faster than 50 mph. The code divides by minutes, so only trips faster than 50 miles a minute go (a quirk kept on purpose).round176488807645486946046
20max_durationRound 3Trip at most 180 minutestravel_time <= 180Trips over three hours are almost always meters left running.round176488807206182206299205265
21tipRound 3Tip at most half the farefare_amount >= 2 * tip_amountThe comment says 'tips more than twice the fare'; the code keeps tips up to half the fare, and the code is what ran.round176488807596042597433596042