Depots.collect_gwr_codes¶
-
Depots.
collect_gwr_codes
(confirmation_required=True, verbose=False)¶ Collect Great Western Railway (GWR) depot codes from source web page.
- Parameters
confirmation_required (bool) – whether to confirm before proceeding, defaults to
True
verbose (bool or int) – whether to print relevant information in console, 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'] >>> print(depots.GWRKey) GWR codes >>> type(gwr_codes_dat[depots.GWRKey]) dict >>> list(gwr_codes_dat[depots.GWRKey].keys()) ['Alphabetical codes', 'Numerical codes'] >>> alpha_codes = gwr_codes_dat[depots.GWRKey]['Alphabetical codes'] >>> type(alpha_codes) pandas.core.frame.DataFrame >>> alpha_codes.head() Code Depot name 0 ABEEG Aberbeeg 1 ABG Aberbeeg 2 AYN Abercynon 3 ABDR Aberdare 4 ABH Aberystwyth