SignalBoxes.fetch_non_national_rail_codes¶
- SignalBoxes.fetch_non_national_rail_codes(update=False, dump_dir=None, verbose=False)[source]¶
Fetches the signal box prefix codes for non-national rail.
- 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 the signal box prefix codes for non-national rail and the date when they were last updated.
- Return type:
dict
Examples:
>>> from pyrcs.other_assets import SignalBoxes # from pyrcs import SignalBoxes >>> sb = SignalBoxes() >>> nnr_codes = sb.fetch_non_national_rail_codes() >>> type(nnr_codes) dict >>> list(nnr_codes.keys()) ['Non-National Rail', 'Last updated date'] >>> sb.KEY_TO_NON_NATIONAL_RAIL 'Non-National Rail' >>> nnr_codes_dat = nnr_codes[sb.KEY_TO_NON_NATIONAL_RAIL] >>> type(nnr_codes_dat) dict >>> list(nnr_codes_dat.keys()) ['Croydon Tramlink signals', 'Docklands Light Railway signals', 'Edinburgh Tramway signals', 'Glasgow Subway signals', 'London Underground signals', 'Luas signals', 'Manchester Metrolink signals', 'Midland Metro signals', 'Nottingham Tram signals', 'Sheffield Supertram signals', 'Tyne & Wear Metro signals', "Heritage, minor and miniature railways and other 'special' signals"] >>> lu_signals_codes = nnr_codes_dat['London Underground signals'] >>> type(lu_signals_codes) dict >>> list(lu_signals_codes.keys()) ['Codes', 'Notes'] >>> type(lu_signals_codes['Codes']) pandas.core.frame.DataFrame >>> lu_signals_codes['Codes'].head() Code ... Became or taken over by (where known) 0 BMX ... - 1 A ... - 2 S ... - 3 X ... - 4 R ... - [5 rows x 5 columns]