Skip to main content

Analyzing the NYC Parking Violations Dataset

4.5GB · 21 million rows

ON THIS PAGE

New York City's extensive parking-violation records provide rich analytical opportunities. This guide explains the dataset schema, demonstrates loading the data into Firebolt, and provides sample SQL queries for analysis.

## Understanding the schema

The dataset contains 44 columns capturing violation details:

Column NameData TypeDescription
summonsIntegerUnique identifier for each violation
plateidTextLicense plate identifier
registrationTextVehicle registration identifier
plateTextLicense plate information
issue_dateDateDate the violation was issued
violation_codeIntegerCode indicating the violation type
vehicle_bodyTextVehicle body type
vehicle_makeTextVehicle manufacturer
issuing_agencyTextAgency responsible for issuing
street_code1IntegerPrimary street code
street_code2IntegerSecondary street code
street_code3IntegerAnother secondary street code
vehicle_expirationTextVehicle registration expiration
violation_locationIntegerViolation location code
violation_precinctIntegerPrecinct where the violation occurred
issuer_precinctIntegerIssuing officer precinct
issuer_codeIntegerIssuing officer code
issuer_commandTextIssuing officer command
issuer_squadTextIssuing officer squad
violation_timeTextTime of the violation
time_first_observedTextWhen the violation was first observed
violation_countyTextCounty of the violation
violation_infront_oppositeTextPosition relative to the address
house_integerTextHouse number identifier
street_nameTextStreet name
intersecting_streetTextIntersecting street name
date_first_observedTextDate first observed
law_sectionIntegerRelevant law section
sub_divisionTextSubdivision information
violation_legal_codeTextLegal code
days_parking_in_effectTextDays when parking restrictions apply
from_hours_in_effectTextStarting time of restrictions
to_hours_in_effectTextEnding time of restrictions
vehicle_colorTextVehicle color
unregistered_vehicleTextUnregistered vehicle indicator
vehicle_yearTextVehicle manufacture year
meter_integerTextMeter number
feet_from_curbIntegerDistance from curb in feet
violation_post_codeTextPostal code
violation_descriptionTextViolation description
no_standing_or_stopping_violationTextStanding/stopping violation indicator
hydrant_violationTextHydrant violation indicator
double_parking_violationTextDouble parking indicator

## Loading data into Firebolt

There are two ways to load the data.

### Option 1: COPY FROM

Let Firebolt infer the schema and create the table automatically:

COPY INTO nyc_parkingviolations FROM 's3://firebolt-sample-datasets-public-us-east-1/nyc_sample_datasets/nycparking/parquet/'WITH PATTERN="*.parquet" AUTO_CREATE=TRUE TYPE=PARQUET;

### Option 2: External table

First create an external table over the Parquet files in S3:

CREATE EXTERNAL TABLE ex_nyc_parkingviolations (  summons Integer,  plateid Text,  registration Text,  plate Text,  issue_date TEXT,  violation_code Integer,  vehicle_body Text,  vehicle_make Text,  issuing_agency Text,  street_code1 Integer,  street_code2 Integer,  street_code3 Integer,  vehicle_expiration Text,  violation_location Integer,  violation_precinct Integer,  issuer_precinct Integer,  issuer_code Integer,  issuer_command Text,  issuer_squad Text,  violation_time Text,  time_first_observed Text,  violation_county Text,  violation_infront_opposit Text,  house_integer Text,  street_name Text,  intersecting_street Text,  date_first_observed Integer,  law_section Integer,  sub_division Text,  violation_legal_code Text,  days_parking_in_effect Text,  from_hours_in_effect Text,  to_hours_in_effect Text,  vehicle_color Text,  unregistered_vehicle Integer,  vehicle_year Text,  meter_integer Text,  feet_from_curb Integer,  violation_post_code Text,  violation_description Text,  no_standing_or_stopping_violation Text,  hydrant_violation Text,  double_parking_violation Text)URL = 's3://firebolt-sample-datasets-public-us-east-1/nyc_sample_datasets/nycparking/parquet/'OBJECT_PATTERN = '*.parquet'TYPE = (PARQUET);

Then create the internal table:

CREATE TABLE nyc_parkingviolations (  summons Integer,  plateid Text,  registration Text,  plate Text,  issue_date Date,  violation_code Integer,  vehicle_body Text,  vehicle_make Text,  issuing_agency Text,  street_code1 Integer,  street_code2 Integer,  street_code3 Integer,  vehicle_expiration Integer,  violation_location Integer,  violation_precinct Integer,  issuer_precinct Integer,  issuer_code Integer,  issuer_command Text,  issuer_squad Text,  violation_time Text,  time_first_observed Text,  violation_county Text,  violation_infront_opposit Text,  house_integer Text,  street_name Text,  intersecting_street Text,  date_first_observed Integer,  law_section Integer,  sub_division Text,  violation_legal_code Text,  days_parking_in_effect Text,  from_hours_in_effect Text,  to_hours_in_effect Text,  vehicle_color Text,  unregistered_vehicle Integer,  vehicle_year Text,  meter_integer Text,  feet_from_curb Integer,  violation_post_code Text,  violation_description Text,  no_standing_or_stopping_violation Text,  hydrant_violation Text,  double_parking_violation Text);

Finally, insert from the external table, converting issue_date to a timestamp:

INSERT INTO nyc_parkingviolationsSELECT summons ,  plateid ,  registration ,  plate ,  TO_TIMESTAMP(issue_date,'YYYY-MM-DD') ,  violation_code ,  vehicle_body ,  vehicle_make ,  issuing_agency ,  street_code1 ,  street_code2 ,  street_code3 ,  vehicle_expiration ,  violation_location ,  violation_precinct ,  issuer_precinct ,  issuer_code ,  issuer_command ,  issuer_squad ,  violation_time ,  time_first_observed ,  violation_county ,  violation_infront_opposit ,  house_integer ,  street_name ,  intersecting_street ,  date_first_observed ,  law_section ,  sub_division ,  violation_legal_code ,  days_parking_in_effect ,  from_hours_in_effect ,  to_hours_in_effect ,  vehicle_color ,  unregistered_vehicle ,  vehicle_year ,  meter_integer ,  feet_from_curb ,  violation_post_code ,  violation_description ,  no_standing_or_stopping_violation ,  hydrant_violation ,  double_parking_violationFROM ex_nyc_parkingviolations;

## Sample SQL queries for analysis

### Count of violations by violation code

Identify the most frequently occurring parking violations.

SELECT violation_code, violation_description, COUNT(*) AS violation_countFROM nyc_parkingviolationsGROUP BY violation_code, violation_descriptionORDER BY violation_count DESC;

### Violations per day

Reveal temporal patterns in violation issuance.

SELECT issue_date, COUNT(*) AS daily_violationsFROM nyc_parkingviolationsGROUP BY issue_dateORDER BY issue_date;

### Top vehicle makes with the most violations

See which vehicle manufacturers are most frequently cited.

SELECT vehicle_make, COUNT(*) AS violation_countFROM nyc_parkingviolationsGROUP BY vehicle_makeORDER BY violation_count DESCLIMIT 10;

### Violations by issuing agency

Categorize violations by the responsible enforcement agency.

SELECT issuing_agency, COUNT(*) AS violation_countFROM nyc_parkingviolationsGROUP BY issuing_agencyORDER BY violation_count DESC;

The dataset invites further exploration to uncover insights about enforcement patterns and vehicle characteristics.