Depots.fetch_gwr_codes

Depots.fetch_gwr_codes(update=False, pickle_it=False, data_dir=None, verbose=False)

Fetch Great Western Railway (GWR) depot codes from local backup.

Parameters
  • update (bool) – whether to do an update check (for the package data), defaults to False

  • pickle_it (bool) – whether to save the data as a pickle file, defaults to False

  • data_dir (str or None) – name of a folder where the pickle file is to be saved, defaults to None

  • 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

Example:

>>> from pyrcs.other_assets import Depots

>>> depots = Depots()

>>> # gwr_codes_dat = depots.fetch_gwr_codes(update=True, verbose=True)
>>> gwr_codes_dat = depots.fetch_gwr_codes()

>>> print(depots.GWRKey)
GWR codes

>>> gwr_codes = gwr_codes_dat[depots.GWRKey]

>>> type(gwr_codes)
dict
>>> list(gwr_codes.keys())
['Alphabetical codes', 'Numerical codes']

>>> gwr_codes_alpha = gwr_codes['Alphabetical codes']

>>> type(gwr_codes_alpha)
pandas.core.frame.DataFrame
>>> gwr_codes_alpha.head()
    Code   Depot name
0  ABEEG     Aberbeeg
1    ABG     Aberbeeg
2    AYN    Abercynon
3   ABDR     Aberdare
4    ABH  Aberystwyth