SignalBoxes.collect_prefix_codes¶
-
SignalBoxes.
collect_prefix_codes
(initial, update=False, verbose=False)¶ Collect signal box prefix codes beginning with
initial
from source web page.- Parameters
initial (str) – initial letter of signal box name (for specifying a target URL)
update (bool) – whether to do an update check (for the package data), defaults to
False
verbose (bool or int) – whether to print relevant information in console, defaults to
False
- Returns
data of signal box prefix codes beginning with
initial
and date of when the data was last updated- Return type
dict
Example:
>>> from pyrcs.other_assets import SignalBoxes >>> sb = SignalBoxes() >>> # sb_a = sb.collect_prefix_codes(initial='a', update=True, verbose=True) >>> sb_a = sb.collect_prefix_codes(initial='a') >>> type(sb_a) dict >>> list(sb_a.keys()) ['A', 'Last updated date'] >>> signal_boxes_a_codes = sb_a['A'] >>> type(signal_boxes_a_codes) pandas.core.frame.DataFrame >>> print(signal_boxes_a_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]