SignalBoxes.collect_ireland_codes¶
- SignalBoxes.collect_ireland_codes(confirmation_required=True, verbose=False, raise_error=False)[source]¶
Collects data of Irish signal cabin prefix codes from the source web page.
- Parameters:
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 Irish signal cabin prefix codes and the date when they were last updated, or
None
if no data is collectd.- Return type:
dict | None
Examples:
>>> from pyrcs.other_assets import SignalBoxes # from pyrcs import SignalBoxes >>> sb = SignalBoxes() >>> ireland_sb_codes = sb.collect_ireland_codes() To collect data of signal box prefix codes of Ireland ? [No]|Yes: yes >>> type(ireland_sb_codes) dict >>> list(ireland_sb_codes.keys()) ['Ireland', 'Notes', 'Last updated date'] >>> sb.KEY_TO_IRELAND 'Ireland' >>> ireland_sb_codes_dat = ireland_sb_codes[sb.KEY_TO_IRELAND] >>> type(ireland_sb_codes_dat) pandas.core.frame.DataFrame >>> ireland_sb_codes_dat.head() Code Signal Cabin Note 0 AD Adelaide 1 AN Antrim 2 AE Athlone 3 AE R Distant signals 4 XG Level crossing signals