SignalBoxes.fetch_prefix_codes¶
-
SignalBoxes.
fetch_prefix_codes
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch signal box prefix codes from local backup.
- Parameters
update (bool) – whether to check on update and proceed to update the package data, defaults to
False
pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to
False
data_dir (str, None) – name of package data folder, defaults to
None
verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to
False
- Returns
data of location codes and date of when the data was last updated
- Return type
dict
Example:
>>> from pyrcs.other_assets import SignalBoxes >>> sb = SignalBoxes() >>> signal_box_prefix_codes_dat = sb.fetch_prefix_codes() >>> type(signal_box_prefix_codes_dat) <class 'dict'> >>> print(list(signal_box_prefix_codes_dat.keys())) ['Signal boxes', 'Last updated date'] >>> signal_box_prefix_codes_ = signal_box_prefix_codes_dat['Signal boxes'] >>> type(signal_box_prefix_codes_) <class 'pandas.core.frame.DataFrame'> >>> print(signal_box_prefix_codes_.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]