ELRMileages.collect_mileage_file

ELRMileages.collect_mileage_file(elr, parsed=True, confirmation_required=True, dump_it=False, verbose=False)

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 confirm before proceeding, defaults to True

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

  • verbose (bool or int) – whether to print relevant information in console, 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  # from pyrcs import ELRMileages

>>> em = ELRMileages()

>>> cjd_mileage_file = em.collect_mileage_file(elr='CJD')
To collect mileage file of "CJD"
? [No]|Yes: yes
>>> type(cjd_mileage_file)
dict
>>> list(cjd_mileage_file.keys())
['ELR', 'Line', 'Sub-Line', 'Mileage', 'Notes']
>>> cjd_mileage_file['Mileage']
    Mileage  ... Link_1_Mile_Chain
0    0.0000  ...
1    0.0528  ...             91.48
2    1.1540  ...
3    2.0000  ...
4    2.1562  ...              0.00
5    6.0022  ...
6    8.0308  ...
7   10.0748  ...
8   12.0968  ...
9   14.0968  ...
10  16.1452  ...
11  19.1408  ...
12  19.1540  ...
13  23.0770  ...
14  26.1078  ...
15  28.1276  ...
16  32.1188  ...
17  32.1188  ...
18  38.1276  ...
19  43.0572  ...
20  46.0704  ...
21  49.1188  ...
22  49.1320  ...              0.00
23  55.1606  ...
24  64.0594  ...
[25 rows x 8 columns]

>>> gam_mileage_file = em.collect_mileage_file(elr='GAM')
To collect mileage file of "GAM"
? [No]|Yes: yes
>>> gam_mileage_file['Mileage']
   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]

>>> sld_mileage_file = em.collect_mileage_file(elr='SLD')
To collect mileage file of "SLD"
? [No]|Yes: yes
>>> sld_mileage_file['Mileage']
   Mileage Mileage_Note Miles_Chains  ... Link_1 Link_1_ELR Link_1_Mile_Chain
0  31.0088                     31.04  ...   MVN2       MVN2
1  31.0682                     31.31  ...   None
2  31.1474                     31.67  ...   None
3  32.1078                     32.49  ...   None
4  32.1232                     32.56  ...   None
[5 rows x 8 columns]

>>> elr_mileage_file = em.collect_mileage_file(elr='ELR')
To collect mileage file of "ELR"
? [No]|Yes: yes
>>> elr_mileage_file['Mileage']
     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   127.1716  Approximate  ...
6   128.0088               ...
7   128.0154               ...        MAB
8   130.0946               ...
9   133.1254               ...
10  134.1694               ...
11  138.0770               ...
12  139.1694               ...        MAB            149.43
13  140.1122               ...        LOB            150.13
14  141.0000               ...
15  143.0792               ...
16  143.0792               ...
17  145.1078               ...
18  146.0594               ...
19  147.1650               ...
20  148.1166               ...
21  149.1452               ...
22  150.1056               ...
23  151.1606               ...
24  154.0088               ...
25  154.0704               ...
26  154.1078               ...
27  154.1628               ...
28  154.1650               ...       MAC3            109.53
[29 rows x 8 columns]