I moved into a flat where I could always hear the rumble of trains, and then I realized that there is an underground railway just next to the flat. The rumbling sound is annoying and I wonder how often the trains pass by. Live timetables for specific train stations can be viewed on the ScotRail official website as shown below,
In order to scrape the information of the live timetable, I wrote a Python code by using the Selenium library to open the website and scrape data every 10 min from 5:00 - 23:59, Monday to Sunday (code/scrape_timetable.py). Event plot (eventplot.py) and bar charts (code/barchat.py) are generated to visualize how many trains pass by per day.
-
Using the Selenium library works well without being denied by the website.
-
There are so many trains passing by every day, so DO NOT stay at home all day! Getting some peace during 21:21-21:45 (24 min) and 22:51-23:20 (29 min). Hope to move out soon...