Visiting the city of Atlanta is great. There are many things to do and interesting people. But in car-centric cities finding parking can be a hassle. And paying for parking, much less dealing with parking ticket is even worse.
If I were to visit a neighboring city on vacation, how can I strategize to avoid a parking ticket?
Posted by DOT in Montgomery, Maryland on Data.gov years 2020-2021
We split the master table into two-appropriate sub-tables
A Location Date table and a Violations table
We are dealing with 100,000+ rows so SQL is best suited
TicketLocations Table
TicketViolations Table
Cleaning Strategy
Remove Null Rows
Fix Date/Time datatype and year errors
Clean Ticket Locations by splitting into Address and Lot#
Create Time Of Day Categories
Condense Parking Violation Types (From 33 similar types, down to 7)
Finalize Tables by dropping columns and adding Primary/Foreign Keys
1) Remove Null Rows
For best practices, we inserted into two new tables: Locations and Violations. Leaving TicketLocations and TicketViolations as our original backup tables.
After removing null rows, our rows reduced from 103,000 to 102,000.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The original Date/Time data type was a ‘string’ and had errors in the typed in years. This was corrected with the below update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3) Clean Locations by Splitting out Lot # and Address
Ticket Locations Column had an entry error where locations were of the format “lot#-Address”.
A secondary error was encountered of the form “lot#-lot#-Address” , hence a secondary split query was performed, and the correct Clean address was confirmed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Originally there were 33 classifications of violations. But many types were self-similar, like off and on street of the same overtime parking violation. Violations were grouped sensibly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Where [Violation Code] = 10 or [Violation Code] = 17 or [Violation Code] = 22 or [Violation Code] = 22 or [Violation Code] = 23 or [Violation Code] = 25 or [Violation Code] = 31 or [Violation Code] = 32 or [Violation Code] = 57
UPDATE ParkingTickets..Violations
Set violation_type = 'No Parking Anytime'
Where [Violation Code] = 3 or [Violation Code] = 5 or [Violation Code] = 34 or [Violation Code] = 37
UPDATE ParkingTickets..Violations
Set violation_type = 'Expired/Overtime'
Where [Violation Code] = 7 or [Violation Code] = 41 or [Violation Code] = 50
UPDATE ParkingTickets..Violations
Set violation_type = 'Sign Violation or Impeding Traffic'
Where [Violation Code] = 9 or [Violation Code] = 35 or [Violation Code] = 36 or [Violation Code] = 43 or [Violation Code] = 54
UPDATE ParkingTickets..Violations
Set violation_type = 'Prohibited Vehicle'
Where [Violation Code] = 2 or [Violation Code] = 38 or [Violation Code] = 42 or [Violation Code] = 48
UPDATE ParkingTickets..Violations
Set violation_type = 'Orientation Violation'
Where [Violation Code] = 8 or [Violation Code] = 19 or [Violation Code] = 20 or [Violation Code] = 24 or [Violation Code] = 27 or [Violation Code] = 28 or [Violation Code] = 59
For proper referencing, keys were added onto the [Ticket ID] Column as a unique identifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Appropriate metrics were created to answer our initial question: How can I avoid a parking ticket?
Our sub questions included:
What is the most common violation, and where does it occur?
What time of day am I most likely to get a ticket?
Is there a specific Month or Weekday I am less likely to get a ticket?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters