Data Analysis on Pittsburgh Bus Ridership

Posted on Jun 12, 2021
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Data Analysis on Pittsburgh Bus RidershipView of downtown Pittsburgh


  • Analyze patterns of bus ridership in Pittsburgh, PA before and during Covid-19
  • Gain insights into and lay the foundation for forecasting ridership once the local economy opens more fully

We expect the data to show a drop in bus ridership during Covid-19. An understanding of how much, how quickly and in what manner ridership will recover has important implications for various entities and outcomes. They include:

  • Port Authority of Allegheny County’s (the transit authority) operational decisions  such as the level of bus service to maintain or the reallocation of bus service across routes
  • Business activity, since a sustained drop in ridership due to increased work from home arrangements can portend reduced
    • office space demand with impact on commercial real estate values
    • business activity that is reliant on office goers such as lunchtime eateries or downtown shopping
  • County/state level planning for 
    • lower tax revenues due to decreased business activity in the above sectors
    • Other items such as potentially different traffic patterns arising from people switching to cars from buses leading to fewer buses but more cars on roads


Pittsburgh has an active public transport system. Its geography comprises two rivers that join up to form a third river. That, combined with its hilly terrain creates limited points of entry into the city due to the presence of bridges and tunnels. Downtown parking is also severely limited, which makes public transport a more attractive option for commuting, particularly to downtown.

Pittsburgh has been proactive in developing public transport by converting a railroad track into a road dedicated only for buses that is called the Busway. It offers speedy connections between downtown and points east of the city. This further increases the attractiveness of public transport. Among other things, Pittsburgh is also a university town with several major universities. Students who attend those schools or the smaller universities around form a significant part of the ridership of buses. 

The Port Authority of Allegheny County is Pittsburgh’s main transit body; it operates buses, light rail and inclines. Figure 1 shows bus route P1 that goes along the Busway while Figure 2 shows bus route 61C that serves both Carnegie Mellon University and University of Pittsburgh on its way to downtown. Both buses travel from the east side of the city to downtown.

Fig. 1 Bus route P1 – travels to downtown along the Busway

Data Analysis on Pittsburgh Bus Ridership

Fig. 2 Bus route 61C – travels to downtown passes through CMU and Pitt 

Data Analysis on Pittsburgh Bus Ridership


The dataset for the analysis was obtained from the Western Pennsylvania Regional Data Center at .

It has the following attributes:

  • The values in the dataset are average ridership by route for each month
  • The average ridership is  broken out across weekday, Saturday and Sunday
  • The data covers ridership across buses, light rail (‘T’) and inclines
  • The data is from Jan 2017 to Mar 2021
  • The dataset is a csv file with 11,884 rows  and 10 columns

For this study, I have focused on ridership data for buses and on weekdays. That covers the majority of the ridership and is also of the most relevance for the objectives of the project. 

As part of data cleansing, I excluded data on three bus routes (details are at the end of this article). 

The data used thus has average weekday ridership for 95 bus routes over a period of 51 months (Jan 2017 to Mar 2021). The code and data can be found at

Summary of Data findings – before Covid

  • The average weekday ridership across all bus routes in Pittsburgh was 179,000 in 2017 and 185,000 in both 2018 and 2019.  The average weekday ridership showed a 3% increase from 2017 to 2018 but was flat from 2018 to 2019.
  • The top 10 bus routes in terms of ridership account for about 33% of total ridership (see Figure 3). All of these serve downtown and 7 of the 10 routes pass through both major universities – Carnegie Mellon University (CMU) and University of Pittsburgh (Pitt). 

Fig. 3 Top 10 bus routes – average weekday ridership in 2019

  • The aggregate bus ridership shows seasonality. This can be seen clearly in Fig 4, which shows the aggregate weekday ridership across all routes. There is a sharp peak in Sept with a correspondingly sharp trough in Dec. Next, there is a smaller peak during Feb - Apr with a smaller trough in June - July.
  • As noted earlier, Pittsburgh is a university town, so it made sense to explore if the seasonality is driven by student ridership. Fig 5 shows the ridership graphs of four different bus routes – P1, 51, 61C and 71C. Of these, the first two – P1 and 51 – go to downtown directly without touching the two main universities (CMU and Pitt), while the other two – 61C and 71C – pass through these two universities and do carry student riders. Fig 5 indicates that:
  • Seasonality appears stronger in bus routes 61C and 71C which is not surprising given that many students tend to leave town during semester breaks
  • At the same time, there is still noticeable seasonality in the bus routes P1 and 51 which suggests that seasonality is not just due to students but is more broadly based and likely due to vacation patterns of the workforce. It seems that people are most present in the office during  Sept - Oct and most away from the office during Nov - Dec with a secondary peak in Feb-Apr and a secondary valley in June-July.

Fig. 4 Weekday aggregate ridership

     Fig 5 Weekday ridership on bus routes P1, 51, 61C and 71C 

Summary of Data findings – during Covid


  • There is a steep decline in aggregate ridership during the Covid period of Apr 2020 – Mar 2021. The average weekday aggregate ridership fell by (see Fig 4) 73% in April 2020, 70% in Dec 2020 and 65% in Mar 2021 relative to the average weekday ridership level during all of 2019. I used the entire year of 2019 as the baseline to control for seasonality. Also, I did not calculate the decline relative to Mar 2020 as some of the impacts of Covid were already reflected during that month.
  • Fig 6 shows a comparison of the distribution of the average weekday ridership across the 95 bus routes during 2019 and during the Covid period. The 2019 boxplot shows the outsize contribution of the top 10 bus routes to ridership that was noted earlier in Fig 3. A comparison of the two boxplots shows that the median of the average weekday ridership among the bus routes has declined by around 60% during the Covid period as compared to 2019. 

Economic Effect

  • The seasonality that was observed during 2017 – 2019 is partly intact during 2020 (Figs 4 and 5). It was disrupted during Apr – June 2020, presumably due to the abrupt shock of the economic shutdown due to Covid. However, during July 2020 – Sept 2020 and Sept 2020 – Dec 2020, the historically observed seasonality can still be seen. The upward trend in ridership seen during Dec 2020 – Mar 2021 is also consistent with the observed seasonality, so the rising trend seen in Mar 2021 may not yet reflect greater opening of the economy.
  • Figure 7 provides another perspective of the drop in ridership during the Covid period by showing the distribution across all bus routes of the percentage drop in ridership during the Covid period relative to the average level in 2019. The distributions are shown in the form of boxplots at three different months during the Covid period – April 2020, Dec 2020 and Mar 2021. The boxplots tell a similar story to what is seen at the aggregate level in Fig 4. 
    • The median percentage drop in April 2020 is around 70%
    • By Dec 2020, the median percentage drop is slightly higher but the spread of the distribution is slightly tighter
    • As of Mar 2021, the distribution has shifted up by about 5%. As this could be due to seasonality, it is too early to tell if there has been a pickup in ridership reflecting the improving pandemic and economic outlook

Fig 6 Bus ridership distribution  -   2019 vs Covid period

      Fig 7 Bus ridership reduction distribution  in Covid period 


The analysis has found the following with respect to average weekday bus ridership in Pittsburgh during Jan 2017 – Mar 2021

  • Ridership is disproportionate across bus routes with the top 10 out of 95 routes contributing 33% of total ridership in 2019
  • Significant seasonality pattern in ridership is seen across bus routes during 2017 – 2019 including those not frequently used by students
  • Ridership drops by around 70% on average across all bus routes at the start of Covid and doesn't pick up through the end of 2020
  • Except for an initial disruption, seasonality was observed even among the depressed levels of ridership in the Covid period, so that the recent pickup in ridership could still be due to seasonality and not due to any secular economic effects

Given the anticipated pace of reopening of workplaces and of universities, it would be opportune to repeat the analysis in the upcoming months using refreshed data to better identify ridership trends.


If the analysis is used to develop forecasts of ridership, it is important that the forecasting methodology is able to separate seasonality from the trend, given the significant role of seasonality in weekday bus ridership. The analysis can also be expanded to include light rail data, which would add more data points particularly for ridership from the south of Pittsburgh. Finally, it may be worth looking more closely at weekend ridership data to identify any trends and insights that could be brought to bear on the current analysis.

This analysis and its further extensions can help with predicting and understanding how working arrangements evolve post covid, to what extent part of the workforce may end up permanently working from home - full time or part time – and the implications of this for the broader economy.

Data cleansing details

Data on the following bus routes was excluded

  • ‘MNT1’
    • It was unclear if this was even a bus route or was just a data error
    • Further the data were very sparse and sporadic across the time period
  • Route 68 – data was available for only 30 for the 51 weeks
  • Route 78 – data was available for only 8 out of the 51 weeks

About Author

Gopal (Sharath) Sharathchandra

Executive with 25+ years experience in financial services and career-long passion for applying analytics and data to addressing business questions. Excited about data science and machine learning. Enjoys reading.
View all posts by Gopal (Sharath) Sharathchandra >

Leave a Comment

No comments found.

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 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