Background
In 2020, Minnesota’s Department of Transportaion put out a great visualization of Minneapolis’ surge in bicycle and pedestrian usage soon after Minneapolis governor Tim Walz declared a ‘Peacetime Emergency’ on March 13, 2020 and a ‘Stay at Home’ order twelve days later on March
Goal
We will similarly explore Arlington, Virginia’s bicycle ridership numbers around Virginia Governor Northram’s State of Emergency Declaration on March 12, 2020 and Stay at Home order on March 30, 2020.
Below is the plot you will create using Arlington’s bike data.
Follow along or explore on your own
Subsequent posts for this project will outline step by step how I went about creating similar visualizations to the Minnesota DOT. I believe this is a great project for those new to Python, R, or databases. Each Part of this project will have a Goal section. You have the option to give the goals a shot on your own before looking at how I accomplished them. If you have any questions, comments, or are working on your own analysis, send me an email!
Requirements
Before you start the project, the requirements are listed below. I’ll document as best I can how to set up the MySQL database and connect everything together in part 3.
- Python 3.6 or later
- R/R Studio
- Very basic Python and R knowledge
Note: To make my life easier, I installed the full Anaconda suite and use the Spyder IDE when working in Python. I played around with installing Miniconda but when it comes to managing the conda environments in R using the Reticulate library, it gave me a headache.
The Datasets
One of the best parts of living in Arlington, Virginia is its beautiful paved bike paths, particularly the Arlington Loop. Riders of the loop probably have noticed the Bikeometer near the Francis Scott Key Memorial Bridge displaying the daily, monthly, and yearly bicycle counts.
To my delight, these numbers are not only publicly available, but also easily requested using an API and detailed documentation. Additionally, Covid-19 case/vaccine data from the Virginia Health Department will be used to visualize how trail usage is affected by major events like a global pandemic.
MySQL
One of my aims for this project was to create a pipeline that foregoes saving individual ‘data’ files (e.g. csv, xml, json, txt) to the computer and instead used a database to store the data. After reading over this great article that gives a good overview of SQLite, PostgreSQL, and MySQL, I decided on MySQL to handle my database. A second factor in my decision was because my favorite Udemy instructor Colt Steele had a MySQL course on sale The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert. I highly recommend it to learn MySQL.
Short Bike Story
Recently, after helping teach my friend how to ride a bike, we excitedly visited the local bike shop to hopefully make a purchase. Unfortunately, over a year into the pandemic, we were told if we ordered today, the bike would be delivered in 6 months.
Later that day, I visited the local used bike shop and was excitedly told that for $400, I could have a refurbished 1997 Bianchi Timber Wolf, a bike which according to BikePedia.com, originally sold for $300. Either this bike had holographic Charizards in its spokes, or demand for bikes is still very high.
Check out Part 2, Query the Bike Arlington API
LS0tDQp0aXRsZTogIlZpc3VhbGl6aW5nIEFybGluZ3RvbiBCaWtvbWV0ZXJzIg0Kc3VidGl0bGU6ICJQYXJ0IDE6IFRoZSBQbGFuIg0Kb3V0cHV0Og0KICBodG1sX2RvY3VtZW50Og0KICAgIHRvYzogdHJ1ZQ0KICAgIHRvY19kZXB0aDogMg0KICAgIHRvY19mbG9hdDogdHJ1ZQ0KICAgIGhpZ2hsaWdodDogemVuYnVybg0KICAgIGNvZGVfZG93bmxvYWQ6IHRydWUNCi0tLQ0KXCANClwgDQoNCiMgQmFja2dyb3VuZA0KSW4gMjAyMCwgTWlubmVzb3RhJ3MgRGVwYXJ0bWVudCBvZiBUcmFuc3BvcnRhaW9uIHB1dCBvdXQgYSBbZ3JlYXQgdmlzdWFsaXphdGlvbl0oaHR0cHM6Ly9zdG9yeW1hcHMuYXJjZ2lzLmNvbS9zdG9yaWVzLzcwYTNhNTcwMDNiNTQxZWQ4ZTkxMWNkMTExMDNkYzZhKSBvZiBNaW5uZWFwb2xpcycgc3VyZ2UgaW4gYmljeWNsZSBhbmQgcGVkZXN0cmlhbiB1c2FnZSBzb29uIGFmdGVyIE1pbm5lYXBvbGlzIGdvdmVybm9yIFRpbSBXYWx6IGRlY2xhcmVkIGEgJ1BlYWNldGltZSBFbWVyZ2VuY3knIG9uIE1hcmNoIDEzLCAyMDIwIGFuZCBhICdTdGF5IGF0IEhvbWUnIG9yZGVyIHR3ZWx2ZSBkYXlzIGxhdGVyIG9uIE1hcmNoIA0KDQojIEdvYWwNCg0KV2Ugd2lsbCBzaW1pbGFybHkgZXhwbG9yZSBBcmxpbmd0b24sIFZpcmdpbmlhJ3MgYmljeWNsZSByaWRlcnNoaXAgbnVtYmVycyBhcm91bmQgVmlyZ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