LOR.collect_keys_to_prefixes¶
- LOR.collect_keys_to_prefixes(confirmation_required=True, verbose=False, raise_error=False)[source]¶
Collects the keys to PRIDE/LOR code prefixes 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 code prefixes and the last updated date, or
Noneif no data is available.- Return type:
dict | None
Examples:
>>> from pyrcs.line_data import LOR # from pyrcs import LOR >>> lor = LOR() >>> keys_to_prefixes = lor.collect_keys_to_prefixes() To collect data of URLs to LOR codes web pages ? [No]|Yes: yes Collecting the data ... Done. >>> assert isinstance(keys_to_prefixes, dict) >>> list(keys_to_prefixes.keys()) ['Key to prefixes', 'Last updated date'] >>> keys_to_prefixes_data = keys_to_prefixes['Key to prefixes'] >>> keys_to_prefixes_data.head() prefixes name 0 CY Wales 1 EA South Eastern: East Anglia area 2 EX generic/example 3 GW Great Western (later known as Western) 4 LN London & North Eastern