ELRMileages.collect_mileage_file¶
-
ELRMileages.
collect_mileage_file
(elr, parsed=True, confirmation_required=True, pickle_it=False, verbose=False)[source]¶ Collect mileage file for the given ELR from source web page.
- Parameters
elr (str) – ELR, e.g.
'CJD'
,'MLA'
,'FED'
parsed (bool) – whether to parse the scraped mileage data
confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
True
pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to
False
verbose (bool or int) – whether to print relevant information in console as the function runs, defaults to
False
- Returns
mileage file for the given
elr
- Return type
dict
Note
In some cases, mileages are unknown hence left blank, e.g. ANI2, Orton Junction with ROB (~3.05)
Mileages in parentheses are not on that ELR, but are included for reference, e.g. ANL, (8.67) NORTHOLT [London Underground]
As with the main ELR list, mileages preceded by a tilde (~) are approximate.
Examples:
>>> from pyrcs.line_data import ELRMileages >>> em = ELRMileages() >>> mileage_dat = em.collect_mileage_file(elr='CJD') To collect mileage file for "CJD"? [No]|Yes: yes >>> type(mileage_dat) <class 'dict'> >>> print(list(mileage_dat.keys())) ['ELR', 'Line', 'Sub-Line', 'Mileage', 'Notes'] >>> mileage_dat = em.collect_mileage_file(elr='GAM') To collect mileage file of "GAM"? [No]|Yes: yes >>> print(mileage_dat['Mileage'].head()) Mileage Mileage_Note Miles_Chains ... Link_1 Link_1_ELR Link_1_Mile_Chain 0 8.1518 8.69 ... None 1 10.0264 10.12 ... None [2 rows x 8 columns] >>> mileage_dat = em.collect_mileage_file(elr='SLD') To collect mileage file of "SLD"? [No]|Yes: yes >>> print(mileage_dat['Mileage'].head()) Mileage Mileage_Note Miles_Chains ... Link_1 Link_1_ELR Link_1_Mile_Chain 0 30.1694 30.77 ... None 1 32.1210 32.55 ... None [2 rows x 8 columns] >>> mileage_dat = em.collect_mileage_file(elr='ELR') To collect mileage file of "ELR"? [No]|Yes: yes >>> print(mileage_dat['Mileage'].head()) Mileage Mileage_Note ... Link_1_ELR Link_1_Mile_Chain 0 122.0044 ... GRS3 1 122.0682 ... 0.00 2 122.0726 ... SPI 0.00 3 122.0836 ... 4 124.0792 ... [5 rows x 8 columns]