ELRMileages.fetch_elr

ELRMileages.fetch_elr(update=False, dump_dir=None, verbose=False)[source]

Fetch data of ELRs and their associated mileages.

Parameters:
  • update (bool) – Whether to check for updates to the package data; defaults to False.

  • dump_dir (str | None) – Path to a directory where the data file will be saved; defaults to None.

  • verbose (bool | int) – Whether to print relevant information to the console; defaults to False.

Returns:

A dictionary containing data for all available ELRs, along with the date of the last update.

Return type:

dict

Examples:

>>> from pyrcs.line_data import ELRMileages  # from pyrcs import ELRMileages
>>> em = ELRMileages()
>>> elrs_codes = em.fetch_elr()
>>> type(elrs_codes)
dict
>>> list(elrs_codes.keys())
['ELRs and mileages', 'Last updated date']
>>> em.KEY
'ELRs and mileages'
>>> elrs_codes_dat = elrs_codes[em.KEY]
>>> type(elrs_codes_dat)
pandas.core.frame.DataFrame
>>> elrs_codes_dat.head()
   ELR  ...         Notes
0  AAL  ...      Now NAJ3
1  AAM  ...  Formerly AML
2  AAV  ...
3  ABB  ...       Now AHB
4  ABB  ...
[5 rows x 5 columns]