Lisbon Subway, why so late?
By: Paulo Lapa
Tags: Python, Transportation, Public Transit, Data Science, Data Visualization

For most people, the subway is the preferred (and unique) transportation method to getting around Lisbon. To many, it is also a daily source of frustration and sweaty delays.

The subway system is rather large for Portuguese standards: with a network length of 45 km it connects 56 stations, and in 2018 it served 169 million passengers. During 2019 Web Summit, one of the largest events in Portugal, that lasted 4 days, it moved more than 5 million passengers.

Yours truly decided to take a data driven approach and try to understand if the delays are as frequent as they are or just unfortunate survivorship bias.

The website of Metro Lisboa provides a public API that shows the current state of the network in real-time. Armed with a raspberry pi and a python scraper (github) I set out to understand how common those breakdowns and problems are, and hopefully give you some rest.

For the past 7 weeks (from the 10th November 2019 through 2nd January 2020), I scraped the aforementioned page in 10 minutes intervals (minus some internet outages), and at a glance it is easy to see how it might not be just a negative collective memory:

Problematic days are the normal: for the first 35 day where there is data, 18 saw at least an issue. Most of the days, only one of the lines have problems (we’ll see who are the poor commuters that suffer with it), but on the 19th of November, all four lines faced troubles, and the 19th December was the most problematic day as well. Lovely to see that there was a Christmas truce, without no issues during the Christmas — New Years week.

The other side of the story is that although the breakdown are frequent, they tend to be short: of the 3559 operating hours of the subway for which I have data( that is, 4 lines over 37 days), only 32 were met with problems.

Where?

“Um mal nunca vem só”, bad luck never comes once. A circulation issue frequently occurs in two or three lines at a time, typically Yellow and Blue, or Green and Blue.

Also, while the commuters from the Yellow line have to wait the longest before the issue is fixed, the commuters in Blue are stranded almost daily. The Red line is relatively unscathed — maybe because it is younger or the importance of the connection to the airport.

When?

The color indicates the number of subway lines with problems

It is rather easy to see that Sundays are the best to use the subway, — although probably not the most useful. Weekdays are always complicated, but things seem to be particularly bad on Wednesday and easier on Tuesdays and Thursdays. Please note that there are a couple outliers on Tuesdays and Wednesdays though.

In general it seems that the subway has an hard time with high-demand periods, as seen with the lower amount of issues during the Christmas week and then a worsening again on the 2nd of January, when the city starts to come back to work.

Also note that the gray cell color is reserved to days without no data and the off-white/yellowish color is the one that indicates no incidents.

When analyzing inside the day, it seems that problems are likely to occur throughout the day, in particular with a small peak in the morning, from 10am through 2pm. However the major bottlenecks appear in the afternoon, in particular from 5pm until 8pm. Please note that the subway is closed between 1 and 6 am.

I think this is caused by an sharp increase in passengers in the afternoon period when people return from work, and stronger network deficiencies that reveal as the day goes on.

Why?

Lack of sense is not a reason for circulation to stop, but a train breakdown is, and also quite common: 6 hours issues registered were because of issues related to trains malfunction.

But, by far, the most common problem are Flow issues (the dreaded “existem problemas de circulação, o tempo de espera pode ser superior ao normal” message, for those that ride the subway), with 22 hours registered. However, this feels rather like a catchall category, as no details are given.

There are rarer problems like Signalization breakdown (< 1 hour), Energy loss (< 1/2 hour), and lastly, passenger incidents and problems not caused by the Lisbon subway (both 1 hour).

As previously noted, it seems that the Yellow and Blue lines are the ones that suffer the most. It seems that each line has is own personal set of problems — Signalization issues on the Yellow line; or Train breakdowns are also common in the Yellow and Green lines.

In particular, issues “ not related to metro” only appear on the Blue and Red lines, from my experience this could be caused by occurrences in S. Sebastião, the station where the two lines meet.

Interesting to see that the Red Line passengers are the best behaved — only there no passenger incident was registered, but maybe we should give it a powerbank.