This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def map_gtfs_table_to_dict(gtfs_file, table_name): | |
""" | |
Read data from a GTFS table, map the data into a list or dict for | |
easier iteration or searching or other use. Each line of the table | |
is mapped into a separate subdict, with a unique key. | |
Many GTFS tables include a unique value (Example: trips_id in the | |
trips.txt table) that this function automatically uses as the | |
dict key. If a tables has no unique key (Example: calendar_dates.txt), | |
the system generates a unique key using an incrementing row counter. |