ELRMileages.fetch_elr

ELRMileages.fetch_elr(update=False, pickle_it=False, data_dir=None, verbose=False)

Fetch ELRs and mileages 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 all available ELRs and date of when the data was last updated

Return type

dict

Example:

>>> from pyrcs.line_data import ELRMileages

>>> em = ELRMileages()

>>> # elrs_dat = em.fetch_elr(update=True, verbose=True)
>>> elrs_dat = em.fetch_elr()

>>> type(elrs_dat)
dict
>>> list(elrs_dat.keys())
['ELRs', 'Last updated date']

>>> print(em.Key)
ELRs

>>> em_codes = elrs_dat[em.Key]

>>> type(em_codes)
pandas.core.frame.DataFrame
>>> em_codes.head()
   ELR  ...         Notes
0  AAL  ...      Now NAJ3
1  AAM  ...  Formerly AML
2  AAV  ...
3  ABB  ...       Now AHB
4  ABB  ...
[5 rows x 5 columns]