LocationIdentifiers.fetch_codes¶
- LocationIdentifiers.fetch_codes(update=False, dump_dir=None, verbose=False)[source]¶
Fetches location codes listed in the CRS, NLC, TIPLOC and STANOX codes catalogue (including other systems’ station codes).
- Parameters:
update (bool) – Whether to check for updates to the package data; defaults to
False
.dump_dir (str | None) – The path to a directory where the data file will be saved; defaults to
None
.verbose (bool | int) – Whether to print relevant information to the console; defaults to
False
.
- Returns:
A dictionary containing location codes and date of when the data was last updated.
- Return type:
dict
Examples:
>>> from pyrcs.line_data import LocationIdentifiers >>> # from pyrcs import LocationIdentifiers >>> lid = LocationIdentifiers() >>> loc_codes = lid.fetch_codes() >>> type(loc_codes) dict >>> list(loc_codes.keys()) ['LocationID', 'Other systems', 'Additional notes', 'Last updated date'] >>> lid.KEY 'LocationID' >>> loc_codes_dat = loc_codes[lid.KEY] >>> type(loc_codes_dat) pandas.core.frame.DataFrame >>> loc_codes_dat.head() Location CRS ... STANME_Note STANOX_Note 0 A1 ... 1 A463 Traded In ... 2 A483 Road Scheme Supervisors Closed ... 3 Aachen ... 4 AA Holidays S524 ... [5 rows x 12 columns]