diff --git a/notebooks/debugging.ipynb b/notebooks/debugging.ipynb new file mode 100644 index 0000000..9532296 --- /dev/null +++ b/notebooks/debugging.ipynb @@ -0,0 +1,1227 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import pickle\n", + "import numpy as np\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "def pkload(path):\n", + " with open(path, 'rb') as f:\n", + " obj = pickle.load(f)\n", + " return obj" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Searching for journeys from Uster, Gschwader (stop 8588052) to Buchs ZH, Furttalstrasse (stop 8595356) with arrival at 17:30 leads to a footpath of over 3.2km + in reality, while the algorithm prints this:\n", + "\n", + "\" Walk 2.1 minutes from Birmensdorf ZH (stop 8502221)\n", + " to Dällikon, Industrie (stop 8576276)\"" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexroute_idstop_id_generaltrip_idstop_idarrival_timedeparture_timestop_sequencestop_namestop_latstop_lontrip_headsigntrip_short_namedirection_iddeparture_first_stoproute_intstop_countstop_introute_descmonotonically_increasing_id
2770819701326-5-A-j19-18502221114.TA.26-5-A-j19-1.37.R8502221:0:22020-05-24 19:35:002020-05-24 19:35:009Birmensdorf ZH47.3574968.437543Pfäffikon SZ18575119:22:0014910276S-Bahn180388626589
\n", + "
" + ], + "text/plain": [ + " index route_id stop_id_general trip_id \\\n", + "27708 197013 26-5-A-j19-1 8502221 114.TA.26-5-A-j19-1.37.R \n", + "\n", + " stop_id arrival_time departure_time stop_sequence \\\n", + "27708 8502221:0:2 2020-05-24 19:35:00 2020-05-24 19:35:00 9 \n", + "\n", + " stop_name stop_lat stop_lon trip_headsign trip_short_name \\\n", + "27708 Birmensdorf ZH 47.357496 8.437543 Pfäffikon SZ 18575 \n", + "\n", + " direction_id departure_first_stop route_int stop_count stop_int \\\n", + "27708 1 19:22:00 149 10 276 \n", + "\n", + " route_desc monotonically_increasing_id \n", + "27708 S-Bahn 180388626589 " + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Birmensdorf ZH\n", + "stop_times = pkload(\"../data/stop_times_df_cyril.pkl\")\n", + "stop_times[stop_times['stop_id_general']==8502221].head(1)" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexroute_idstop_id_generaltrip_idstop_idarrival_timedeparture_timestop_sequencestop_namestop_latstop_lontrip_headsigntrip_short_namedirection_iddeparture_first_stoproute_intstop_countstop_introute_descmonotonically_increasing_id
193522235226-449-j19-1857627617.TA.26-449-j19-1.1.H8576276NaT2020-05-24 07:00:002Dällikon, Industrie47.4447378.438783Buchs-Dällikon, Bahnhof4747007:00:00193474Bus8589935205
\n", + "
" + ], + "text/plain": [ + " index route_id stop_id_general trip_id stop_id \\\n", + "1935 222352 26-449-j19-1 8576276 17.TA.26-449-j19-1.1.H 8576276 \n", + "\n", + " arrival_time departure_time stop_sequence stop_name \\\n", + "1935 NaT 2020-05-24 07:00:00 2 Dällikon, Industrie \n", + "\n", + " stop_lat stop_lon trip_headsign trip_short_name \\\n", + "1935 47.444737 8.438783 Buchs-Dällikon, Bahnhof 4747 \n", + "\n", + " direction_id departure_first_stop route_int stop_count stop_int \\\n", + "1935 0 07:00:00 19 3 474 \n", + "\n", + " route_desc monotonically_increasing_id \n", + "1935 Bus 8589935205 " + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Dallikon Industrie\n", + "stop_times[stop_times['stop_id_general']==8576276].head(1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "A google maps footpaths using GPS coordinates yields a walk of 14.1 km. Is there a footpath defined between those two stops in transfers ?" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [], + "source": [ + "transfers = pkload(\"../data/transfer_df_cyril.pkl\")" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexstop_id_generalstop_intstop_lat_firststop_lon_firststop_name_firststop_id_general_2stop_int_2stop_lat_first_2stop_lon_first_2stop_name_first_2distancewalking_timemonotonically_increasing_id
13003887850222127647.3575578.437543Birmensdorf ZH857371847347.3571258.438801Birmensdorf ZH, Bahnhof0.106219127352187318287
13013888850222127647.3575578.437543Birmensdorf ZH850295087747.3539368.437175Birmensdorf ZH, Zentrum0.403584484352187318288
13023889850222127647.3575578.437543Birmensdorf ZH8583870115447.3572348.437013Birmensdorf ZH, Bahnhof Süd0.05366664352187318289
\n", + "
" + ], + "text/plain": [ + " index stop_id_general stop_int stop_lat_first stop_lon_first \\\n", + "1300 3887 8502221 276 47.357557 8.437543 \n", + "1301 3888 8502221 276 47.357557 8.437543 \n", + "1302 3889 8502221 276 47.357557 8.437543 \n", + "\n", + " stop_name_first stop_id_general_2 stop_int_2 stop_lat_first_2 \\\n", + "1300 Birmensdorf ZH 8573718 473 47.357125 \n", + "1301 Birmensdorf ZH 8502950 877 47.353936 \n", + "1302 Birmensdorf ZH 8583870 1154 47.357234 \n", + "\n", + " stop_lon_first_2 stop_name_first_2 distance walking_time \\\n", + "1300 8.438801 Birmensdorf ZH, Bahnhof 0.106219 127 \n", + "1301 8.437175 Birmensdorf ZH, Zentrum 0.403584 484 \n", + "1302 8.437013 Birmensdorf ZH, Bahnhof Süd 0.053666 64 \n", + "\n", + " monotonically_increasing_id \n", + "1300 352187318287 \n", + "1301 352187318288 \n", + "1302 352187318289 " + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# transfers from Birmensdorf ZH\n", + "transfers[transfers['stop_id_general']==8502221]" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [], + "source": [ + "# Transfers from Dallikon Industrie" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexstop_id_generalstop_intstop_lat_firststop_lon_firststop_name_firststop_id_general_2stop_int_2stop_lat_first_2stop_lon_first_2stop_name_first_2distancewalking_timemonotonically_increasing_id
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: [index, stop_id_general, stop_int, stop_lat_first, stop_lon_first, stop_name_first, stop_id_general_2, stop_int_2, stop_lat_first_2, stop_lon_first_2, stop_name_first_2, distance, walking_time, monotonically_increasing_id]\n", + "Index: []" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "transfers[transfers['stop_id_general']==8576276]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "There are no footpaths between Birmensdorf ZH and Dallikon Industrie, and interestingly, Dallikon Industrie has no footpaths at all. That points to a bug with the gestion of 'None' pointers in the array stops for footpaths" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [], + "source": [ + "transfer_array = pkload(\"../data/transfer_array_cyril.pkl\")\n", + "stops = pkload(\"../data/stops_array_cyril.pkl\")" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[3075, 1297.0],\n", + " [3119, 1300.0],\n", + " [3131, 1303.0]], dtype=object)" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# transfers from Birmensdorf ZH\n", + "stop_int = 276\n", + "stops[stop_int-1:stop_int+2]" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 473, 127],\n", + " [ 877, 484],\n", + " [1154, 64]])" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "transfer_array[int(stops[stop_int][1]):int(stops[stop_int+1][1])]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**The first entry of transfer_array[276] corresponding to Birmensdorf ZH is 473, which is one less than 474, the stop_id of Dallikon Industrie**. That may be a clue to what's going wrong with the algorithm." + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[5408, 2157.0],\n", + " [5417, nan],\n", + " [5420, 2160.0]], dtype=object)" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# transfers from Dallikon Industrie\n", + "stop_int = 474\n", + "stops[stop_int-1:stop_int+2]\n" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "ename": "ValueError", + "evalue": "cannot convert float NaN to integer", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# Trying to access the transfer for the nan pointer (SHOULD FAIL)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mtransfer_array\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstops\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstop_int\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstops\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstop_int\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mValueError\u001b[0m: cannot convert float NaN to integer" + ] + } + ], + "source": [ + "# Trying to access the transfer for the nan pointer (SHOULD FAIL)\n", + "transfer_array[int(stops[stop_int][1]):int(stops[stop_int+1][1])]" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [], + "source": [ + "# checking out what's around the nan pointer:" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 276, 127],\n", + " [ 877, 450],\n", + " [1154, 162]])" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "transfer_array[int(stops[stop_int-1][1]):int(stops[stop_int+1][1])]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The first entry of transfer_array[stop_int-1] is 276, the stop_int of Birmensdorf ZH. However, that is unlikely to be the source of the problem as we are walking from 276 to 474, and thus accessing transfer_array through stops[276][1]." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## recapitulating the bug with another journey\n", + "\n", + "Searching for journeys from Dübendorf, Branzenäsch (stop 8590551) to Kloten, Weinbergstrasse (stop 8579967) with arrival at 17:30 gives an impossible first walk from Dübendorf, Branzenäsch to Uetliberg (stop 8503057)." + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexroute_idstop_id_generaltrip_idstop_idarrival_timedeparture_timestop_sequencestop_namestop_latstop_lontrip_headsigntrip_short_namedirection_iddeparture_first_stoproute_intstop_countstop_introute_descmonotonically_increasing_id
9587311035026-752-j19-18590551190.TA.26-752-j19-1.4.R85905512020-05-24 07:16:002020-05-24 07:16:0011Dübendorf, Branzenäsch47.3946658.631157Dübendorf, Kunsteisbahn1420107:06:0056315503Bus627065226053
\n", + "
" + ], + "text/plain": [ + " index route_id stop_id_general trip_id \\\n", + "95873 110350 26-752-j19-1 8590551 190.TA.26-752-j19-1.4.R \n", + "\n", + " stop_id arrival_time departure_time stop_sequence \\\n", + "95873 8590551 2020-05-24 07:16:00 2020-05-24 07:16:00 11 \n", + "\n", + " stop_name stop_lat stop_lon trip_headsign \\\n", + "95873 Dübendorf, Branzenäsch 47.394665 8.631157 Dübendorf, Kunsteisbahn \n", + "\n", + " trip_short_name direction_id departure_first_stop route_int \\\n", + "95873 1420 1 07:06:00 563 \n", + "\n", + " stop_count stop_int route_desc monotonically_increasing_id \n", + "95873 15 503 Bus 627065226053 " + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Dübendorf, Branzenäsch\n", + "stop_times[stop_times['stop_id_general']== 8590551].head(1)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexroute_idstop_id_generaltrip_idstop_idarrival_timedeparture_timestop_sequencestop_namestop_latstop_lontrip_headsigntrip_short_namedirection_iddeparture_first_stoproute_intstop_countstop_introute_descmonotonically_increasing_id
53045174926-10-B-j19-18503057181.TA.26-10-B-j19-1.9.H85030572020-05-24 07:14:00NaT8Uetliberg47.3523668.487651Uetliberg23511007:03:00624415S-Bahn25769805095
\n", + "
" + ], + "text/plain": [ + " index route_id stop_id_general trip_id \\\n", + "5304 51749 26-10-B-j19-1 8503057 181.TA.26-10-B-j19-1.9.H \n", + "\n", + " stop_id arrival_time departure_time stop_sequence stop_name \\\n", + "5304 8503057 2020-05-24 07:14:00 NaT 8 Uetliberg \n", + "\n", + " stop_lat stop_lon trip_headsign trip_short_name direction_id \\\n", + "5304 47.352366 8.487651 Uetliberg 23511 0 \n", + "\n", + " departure_first_stop route_int stop_count stop_int route_desc \\\n", + "5304 07:03:00 62 4 415 S-Bahn \n", + "\n", + " monotonically_increasing_id \n", + "5304 25769805095 " + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Uetliberg (stop 8503057)\n", + "stop_times[stop_times['stop_id_general']== 8503057].head(1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "A google maps search for footpaths between the coordinates yields a 14.5 km walk." + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexstop_id_generalstop_intstop_lat_firststop_lon_firststop_name_firststop_id_general_2stop_int_2stop_lat_first_2stop_lon_first_2stop_name_first_2distancewalking_timemonotonically_increasing_id
22562938859055150347.3946658.631157Dübendorf, Branzenäsch859058741447.3930538.633367Dübendorf, Sonnenberg0.244501293618475290624
22572939859055150347.3946658.631157Dübendorf, Branzenäsch859055559947.3948778.628714Dübendorf, Claridenstrasse0.185439222618475290625
22582940859055150347.3946658.631157Dübendorf, Branzenäsch859058188647.3915578.634876Dübendorf, Raubbühl0.444715533618475290626
22592941859055150347.3946658.631157Dübendorf, Branzenäsch859055093147.3970488.625614Dübendorf, Bettlistrasse0.494279593618475290627
22602942859055150347.3946658.631157Dübendorf, Branzenäsch8590590122647.3905358.632469Dübendorf, Sunnhalde0.469644563618475290628
22612943859055150347.3946658.631157Dübendorf, Branzenäsch8590562124447.3962408.629935Dübendorf, Glärnischstrasse0.197806237618475290629
22622944859055150347.3946658.631157Dübendorf, Branzenäsch8590549139247.3948178.634580Dübendorf, Bauhof0.258181309618475290630
\n", + "
" + ], + "text/plain": [ + " index stop_id_general stop_int stop_lat_first stop_lon_first \\\n", + "2256 2938 8590551 503 47.394665 8.631157 \n", + "2257 2939 8590551 503 47.394665 8.631157 \n", + "2258 2940 8590551 503 47.394665 8.631157 \n", + "2259 2941 8590551 503 47.394665 8.631157 \n", + "2260 2942 8590551 503 47.394665 8.631157 \n", + "2261 2943 8590551 503 47.394665 8.631157 \n", + "2262 2944 8590551 503 47.394665 8.631157 \n", + "\n", + " stop_name_first stop_id_general_2 stop_int_2 stop_lat_first_2 \\\n", + "2256 Dübendorf, Branzenäsch 8590587 414 47.393053 \n", + "2257 Dübendorf, Branzenäsch 8590555 599 47.394877 \n", + "2258 Dübendorf, Branzenäsch 8590581 886 47.391557 \n", + "2259 Dübendorf, Branzenäsch 8590550 931 47.397048 \n", + "2260 Dübendorf, Branzenäsch 8590590 1226 47.390535 \n", + "2261 Dübendorf, Branzenäsch 8590562 1244 47.396240 \n", + "2262 Dübendorf, Branzenäsch 8590549 1392 47.394817 \n", + "\n", + " stop_lon_first_2 stop_name_first_2 distance walking_time \\\n", + "2256 8.633367 Dübendorf, Sonnenberg 0.244501 293 \n", + "2257 8.628714 Dübendorf, Claridenstrasse 0.185439 222 \n", + "2258 8.634876 Dübendorf, Raubbühl 0.444715 533 \n", + "2259 8.625614 Dübendorf, Bettlistrasse 0.494279 593 \n", + "2260 8.632469 Dübendorf, Sunnhalde 0.469644 563 \n", + "2261 8.629935 Dübendorf, Glärnischstrasse 0.197806 237 \n", + "2262 8.634580 Dübendorf, Bauhof 0.258181 309 \n", + "\n", + " monotonically_increasing_id \n", + "2256 618475290624 \n", + "2257 618475290625 \n", + "2258 618475290626 \n", + "2259 618475290627 \n", + "2260 618475290628 \n", + "2261 618475290629 \n", + "2262 618475290630 " + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# footpaths from Dübendorf, Branzenäsch\n", + "transfers[transfers['stop_id_general']== 8590551]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "No sign of Uetliberg here." + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexstop_id_generalstop_intstop_lat_firststop_lon_firststop_name_firststop_id_general_2stop_int_2stop_lat_first_2stop_lon_first_2stop_name_first_2distancewalking_timemonotonically_increasing_id
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: [index, stop_id_general, stop_int, stop_lat_first, stop_lon_first, stop_name_first, stop_id_general_2, stop_int_2, stop_lat_first_2, stop_lon_first_2, stop_name_first_2, distance, walking_time, monotonically_increasing_id]\n", + "Index: []" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# transfers from Uetliberg (stop 8503057)\n", + "transfers[transfers['stop_id_general']== 8503057]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Again, utliberg has no footpaths, like Dallikon Industrie in the previous bug." + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[5599, 2253.0],\n", + " [5603, 2256.0],\n", + " [5606, 2263.0]], dtype=object)" + ] + }, + "execution_count": 79, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# footpaths from Dübendorf, Branzenäsch\n", + "stop_int = 503\n", + "stops[stop_int-1:stop_int+2]" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 414, 293],\n", + " [ 599, 222],\n", + " [ 886, 533],\n", + " [ 931, 593],\n", + " [1226, 563],\n", + " [1244, 237],\n", + " [1392, 309]])" + ] + }, + "execution_count": 80, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "transfer_array[int(stops[stop_int][1]):int(stops[stop_int+1][1])]" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[5599, 2253.0],\n", + " [5603, 2256.0]], dtype=object)" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "stops[stop_int-1:stop_int+1]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}