{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%%capture\n", "!pip install -r requirements.txt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Tubemaps" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "london_stations = pd.read_csv(\"../dataset/tubemaps/london.stations.csv\")\n", "london_connections = pd.read_csv(\"../dataset/tubemaps/london.connections.csv\")\n", "london_lines = pd.read_csv(\"../dataset/tubemaps/london.lines.csv\")" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "# Map Bounds to limit stations of interest\n", "lat_max = 51.5345\n", "lat_min = 51.4860\n", "long_max = -0.0725\n", "long_min = -0.1527\n", "\n", "london_stations_filtered = london_stations[(london_stations['latitude'] <= lat_max) & \n", " (london_stations['latitude'] >= lat_min) & \n", " (london_stations['longitude'] <= long_max) & \n", " (london_stations['longitude'] >= long_min)]\n", "london_stations_filtered = london_stations_filtered.drop(columns=['Unnamed: 0']).drop_duplicates()\n", "london_stations_filtered.to_csv(\"dataset/stations.csv\", index=False)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | station1 | \n", "station2 | \n", "line | \n", "time | \n", "
---|---|---|---|---|
2 | \n", "49 | \n", "87 | \n", "1 | \n", "1 | \n", "
3 | \n", "49 | \n", "197 | \n", "1 | \n", "2 | \n", "
6 | \n", "84 | \n", "148 | \n", "1 | \n", "3 | \n", "
7 | \n", "87 | \n", "279 | \n", "1 | \n", "2 | \n", "
16 | \n", "148 | \n", "279 | \n", "1 | \n", "1 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
398 | \n", "107 | \n", "273 | \n", "11 | \n", "2 | \n", "
400 | \n", "192 | \n", "277 | \n", "11 | \n", "2 | \n", "
401 | \n", "198 | \n", "272 | \n", "11 | \n", "1 | \n", "
402 | \n", "198 | \n", "273 | \n", "11 | \n", "3 | \n", "
405 | \n", "13 | \n", "279 | \n", "12 | \n", "4 | \n", "
67 rows × 4 columns
\n", "