-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
The stop ids in the example are taken from the index in the pandas dataframe instead of the 'stop_I' column. This is not a problem in the Finnish dataset, but not all ids are the same the index number. (for example. the Dutch public transport dataset from www.openOV.nl starts with 1 instead of 0)
Code change proposals:
stop_dict = G.stops().to_dict("index")
for stop_I, data in stop_dict.items():
if data['name'] == from_stop_name:
from_stop_I = stop_I
if data['name'] == to_stop_name:
to_stop_I = stop_I
assert (from_stop_I is not None)
assert (to_stop_I is not None)
TO:
stop_data = OV_data.stops()
from_stop_I = stop_data[stop_data['name'] == from_stop_name].stop_I.values[0]
to_stop_I = stop_data[stop_data['name'] == to_stop_name].stop_I.values[0]
AND FROM:
stop_dict = G.stops().to_dict("index")
print("Origin: ", stop_dict[from_stop_I])
print("Destination: ", stop_dict[to_stop_I])
TO:
stop_data = OV_data.stops()
print("Origin: ", stop_data[stop_data['stop_I'] == from_stop_I])
print("Destination: ", stop_data[stop_data['stop_I'] == to_stop_I])
Metadata
Metadata
Assignees
Labels
No labels