Hubway Bike Share: Ridership Patterns

Posted on Feb 5, 2017

The skills the authors demonstrated here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Contributed by Thomas Kassel. He is currently enrolled in the NYC Data Science Academy remote bootcamp program taking place from January-May 2017. This post is based on his first class project, Exploratory Data Analysis with R, focusing on basic EDA and data visualization.


Boston’s bike share program, Hubway, has quickly become an enojoyable, convenient, and affordable means to navigate the city. Publicly owned by municipalities in Greater Boston and operated by national bike organization Motivate, Hubway’s increasing popularity is consistent with national trends of greater attention to sustainable transport in metro areas.

Environmental, monetary and convenience benefits aside, most bike share programs have embraced the influx of big data collected by their bike/station technology. Hubway in particular uses the plentiful ridership data for its own business insights, and posts the raw datasets publicly for any aspiring data scientist to investigate. The purpose of this project was to explore general ridership and demographic patterns in Hubway’s historic data.


Hubway - the Hubway Trip History dataset contains information on over 1M bike trips spanning from the program’s inception in 2011 to mid-2013. Due to long processing times, this initial dataset was subsetted to include only the summer of 2012 (Jun-Sept), which still represented ~300,000 entries. Information about the variables collected (trip duration, start/end station, rider information) can be found at the site link above.

Zipcodes - Each observation (trip) in the dataset above features the rider’s registered zipcode. A reference table mapping those numeric zipcodes to their corresponding neighborhood/towns was compiled using the following public sources:,, R package zipcode.

Weather - public daily weather data for Greater Boston was accessed and tabularized from Weather Underground.


1) Exploration of General Ridership Patterns

Important features provided in the Trip History dataset are the timestamps (minute-level granularity) of departure and arrival for each Hubway trip taken. These variables allow for analysis of ridership activity from the perspective of our normal temporal routines - commuting, socializing, weekend excursions, etc.

Density plots help to visualize hourly ridership throughout the course of an average weekday or weekend. Here we see an obvious “M” shape on the weekday density curve, very likely due to commuting activity (roughly including weekday hours from 7-9AM and 4-7PM).

Further analysis reveals that these commuting rides accounted for 33% of total trips (including weekends) during the summer of 2012. Average weekend profiles exhibit an opposite daily profile with peak ridership occurring in the afternoons. A small, but noticeable amount of weekend rides occur from 12AM-3AM catering to more ‘adventurous’ biker-bar-goers.


We can further solidify weekday-vs-weekend behavior using density plots as a function of total trips and average trip duration. In the right-hand panel we observe a noticeable difference in the distributions of daily rides - on a given weekday, there are 500-750 more rides than a given weekend.

In the left-hand panel we see that the distribution of weekend trips has a mean trip duration of approximately 10 minutes longer than that of weekday trips, with an average trip time of ~25 mins. Hubway rides max out at 30 minutes, so weekend riders tend to make the most of their riding time.

Together, these two observations suggest that Hubway lends itself well to higher-frequency, faster weekday schedules (commuting), in addition to slower-paced weekend routines (recreational rides and sightseeing).


2) Exploration of Rider Demographics

The inclusion of rider information (which is gathered at registration for annual membership) provides interesting potential for analysis of Hubway’s demographics. Namely, for each ride in the Trip History dataset, the rider’s zipcode, age and gender is also included. Using the compiled zipcode table described in the introductory section, each rider’s zipcode was matched to its corresponding Boston neighborhood or surrounding suburb. The plot below shows the top ten demographic cohorts (i.e. groups of gender-age-neighborhood combinations), by total rides in summer 2012. It is worth noting:

  • There were no female cohorts in the top ten ridership groups for either Greater Boston or the Suburbs; all cohorts depicted below are male.
  • Because of the low number of riders from the suburbs, the y-axis for suburban cohorts has been scaled up; however on absolute terms, these rides constitute a significantly lower proportion than Greater Boston residents.


Males, of all ages, from the South End and Back Bay neighborhoods, play a very significant role in Hubway’s membership base; together they made up 17% of all registered Hubway rides during the summer of 2012. Trips are also quite popular among male millenials in other densely populated parts of Boston.

Although substantially smaller by trip volume, Hubway appears to have maintained a loyal member base from the suburbs. This segment is dominated by middle-aged males from nearby Boston towns, making heavy use of Hubway stations located at MBTA hubs (commuter rail or ferry), most notably North Station, South Station and Rowes Wharf Ferry Landing (not shown on graph).


Hubway has solidified its place as a viable transportation option in Greater Boston, as evidenced by incorporation of bike trips into daily routines and high adoption among particular demographic groups.

Integration of external datasets could provide further insights into the drivers for increased ridership. To examine the impact of short-term, localized events, use of publicly available subway data could attempt to draw correlations between daily MBTA maintenance/recorded downtime and increased Hubway rides. Schedules of large city-wide events encouraging travel and sight-seeing (Red Sox games, Boston Marathon, 4th of July Fireworks) could also point to ridership spikes. With an eye to longer-term Hubway growth, study of urban planning initiatives (public spaces, increased transit coverage) and commercial/residential development of new neighborhoods could indicate good candidates for new bike stations.

About Author

Thomas Kassel

Thomas completed a B.A. at Wesleyan University, focusing on molecular neuroscience while completing additional coursework in math and economics. After transitioning from the life sciences into the field of clean technology he joined his current firm, energy efficiency...
View all posts by Thomas Kassel >

Related Articles

Leave a Comment

Hubway Bike Share: Ridership Patterns – Mubashir Qasim February 5, 2017
[…] article was first published on R – NYC Data Science Academy Blog, and kindly contributed to […]

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI