SignalBoxes.fetch_prefix_codes¶
- SignalBoxes.fetch_prefix_codes(update=False, dump_dir=None, verbose=False)[source]¶
Fetches the data of signal box prefix 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 the data of signal box prefix codes and the date whey they were last updated.
- Return type:
dict
Examples:
>>> from pyrcs.other_assets import SignalBoxes # from pyrcs import SignalBoxes >>> sb = SignalBoxes() >>> sb_prefix_codes = sb.fetch_prefix_codes() >>> type(sb_prefix_codes) dict >>> list(sb_prefix_codes.keys()) ['Signal boxes', 'Last updated date'] >>> sb.KEY 'Signal boxes' >>> sb_prefix_codes_dat = sb_prefix_codes[sb.KEY] >>> type(sb_prefix_codes_dat) pandas.core.frame.DataFrame >>> sb_prefix_codes_dat.head() Code Signal Box ... Closed Control to 0 AF Abbey Foregate Junction ... 1 AJ Abbey Junction ... 16 February 1992 Nuneaton (NN) 2 R Abbey Junction ... 16 February 1992 Nuneaton (NN) 3 AW Abbey Wood ... 13 July 1975 Dartford (D) 4 AE Abbey Works East ... 1 November 1987 Port Talbot (PT) [5 rows x 8 columns]