Tunnels.fetch_codes
- Tunnels.fetch_codes(update=False, dump_dir=None, verbose=False)
Fetch data of railway tunnel lengths.
- Parameters
update (bool) – whether to do an update check (for the package data), defaults to
False
dump_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 railway tunnel lengths (including the name, length, owner and relative location) and date of when the data was last updated
- Return type
dict
Examples:
>>> from pyrcs.other_assets import Tunnels # from pyrcs import Tunnels >>> tunl = Tunnels() >>> tunl_len_codes = tunl.fetch_codes() >>> type(tunl_len_codes) dict >>> list(tunl_len_codes.keys()) ['Tunnels', 'Last updated date'] >>> tunl.KEY 'Tunnels' >>> tunl_len_codes_dat = tunl_len_codes[tunl.KEY] >>> type(tunl_len_codes_dat) dict >>> list(tunl_len_codes_dat.keys()) ['Page 1 (A-F)', 'Page 2 (G-P)', 'Page 3 (Q-Z)', 'Page 4 (others)'] >>> page_1 = tunl_len_codes_dat['Page 1 (A-F)'] >>> type(page_1) pandas.core.frame.DataFrame >>> page_1.head() Name Other names, remarks ... Length (metres) Length (note) 0 Abbotscliffe ... 1775.7648 1 Abercanaid see Merthyr ... NaN Unavailable 2 Aberchalder see Loch Oich ... NaN Unavailable 3 Aberdovey No 1 also called Frongoch ... 182.8800 4 Aberdovey No 2 also called Morfor ... 200.2536 [5 rows x 11 columns]