Data Analysis on Pittsburgh Bus Ridership
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
View 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
Fig. 2 Bus route 61C – travels to downtown passes through CMU and Pitt
The dataset for the analysis was obtained from the Western Pennsylvania Regional Data Center at https://data.wprdc.org/dataset/port-authority-monthly-average-ridership-by-route .
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 https://github.com/gopalsharath/pitt-bus-ridership.git
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.
- 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
- 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