Depots.collect_gwr_codes¶
-
Depots.
collect_gwr_codes
(confirmation_required=True, verbose=False)[source]¶ Collect Great Western Railway (GWR) depot codes from source web page.
- Parameters
confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
True
verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to
False
- Returns
data of GWR depot codes and date of when the data was last updated
- Return type
dict or None
Example:
>>> from pyrcs.other_assets import Depots >>> depots = Depots() >>> gwr_codes_dat = depots.collect_gwr_codes() To collect data of GWR codes? [No]|Yes: yes >>> type(gwr_codes_dat) dict >>> list(gwr_codes_dat.keys()) ['GWR codes', 'Last updated date'] >>> type(gwr_codes_dat['GWR codes']) dict >>> list(gwr_codes_dat['GWR codes'].keys()) ['Alphabetical codes', 'Numerical codes'] >>> print(gwr_codes_dat['GWR codes']['Alphabetical codes'].head()) Code Depot name 0 ABEEG Aberbeeg 1 ABG Aberbeeg 2 AYN Abercynon 3 ABDR Aberdare 4 ABH Aberystwyth