Viaducts.fetch_codes¶
- Viaducts.fetch_codes(update=False, dump_dir=None, verbose=False)[source]¶
Fetches the data of railway viaducts.
- Parameters:
update (bool) – Whether to check for updates to the package data; defaults to
False
.dump_dir (str | None) – The 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 the data of railway viaducts and the date of when the data was last updated.
- Return type:
dict
Examples:
>>> from pyrcs.other_assets import Viaducts # from pyrcs import Viaducts >>> vdct = Viaducts() >>> vdct_codes = vdct.fetch_codes() >>> type(vdct_codes) dict >>> list(vdct_codes.keys()) ['Viaducts', 'Last updated date'] >>> vdct.KEY 'Viaducts' >>> vdct_codes_dat = vdct_codes[vdct.KEY] >>> type(vdct_codes_dat) dict >>> list(vdct_codes_dat.keys()) ['Page 1 (A-C)', 'Page 2 (D-G)', 'Page 3 (H-K)', 'Page 4 (L-P)', 'Page 5 (Q-S)', 'Page 6 (T-Z)'] >>> page_6_codes = vdct_codes_dat['Page 6 (T-Z)'] >>> type(page_6_codes) pandas.core.frame.DataFrame >>> page_6_codes.head() Name Notes ... End mileage Spans 0 Tadcaster crosses River Wharfe; grade II listed ... 11 1 Taff see Red Bridge ... 2 Taff ... 3 Taff River also called Afon Taff ... 170m 42ch 4 Taffs Well see River Taff ... [5 rows x 7 columns]