Viaducts.collect_codes¶
- Viaducts.collect_codes(page_no, confirmation_required=True, verbose=False, raise_error=False)[source]¶
Collects data of railway viaducts for a specific page number from the source web page.
- Parameters:
page_no (int | str) – The page number to collect data from; valid values are
1
,2
,3
and4
.confirmation_required (bool) – Whether user confirmation is required; if
confirmation_required=True
(default), prompts the user for confirmation before proceeding with data collection.verbose (bool | int) – Whether to print relevant information to the console; defaults to
False
.raise_error (bool) – Whether to raise the provided exception; if
raise_error=False
(default), the error will be suppressed.
- Returns:
A dictionary containing the data of railway viaducts for the specified
page_no
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() >>> page_1_codes = vdct.collect_codes(page_no=1) >>> type(page_1_codes) dict >>> list(page_1_codes.keys()) ['Page 1 (A-C)', 'Last updated date'] >>> page_1_dat = page_1_codes['Page 1 (A-C)'] >>> type(page_1_dat) pandas.core.frame.DataFrame >>> page_1_dat.head() Name ... Spans 0 7 Arches ... 7 1 36 Arch ... 36 2 42 Arch ... 3 A698 ... 5 4 Abattoir Road ... 8 [5 rows x 7 columns]