LOR.get_keys_to_prefixes¶
- LOR.get_keys_to_prefixes(prefixes_only=True, update=False, verbose=False)[source]¶
Gets the keys to PRIDE/LOR code prefixes.
- Parameters:
prefixes_only (bool) – If
True
(default), returns only the prefixes; otherwise, additional information, including the last updated date.update (bool) – Whether to check for updates to the package data; defaults to
False
.verbose (bool | int) – Whether to print relevant information to the console; defaults to
False
.
- Returns:
A list of the keys to LOR code prefixes if
prefixes_only=True
, otherwise a dictionary containing code prefixes and the last updated date, orNone
if no data is available.- Return type:
list | dict | None
Examples:
>>> from pyrcs.line_data import LOR # from pyrcs import LOR >>> lor = LOR() >>> keys_to_pfx = lor.get_keys_to_prefixes() >>> keys_to_pfx ['CY', 'EA', 'GW', 'LN', 'MD', 'NW', 'NZ', 'SC', 'SO', 'SW', 'XR'] >>> keys_to_pfx = lor.get_keys_to_prefixes(prefixes_only=False) >>> type(keys_to_pfx) dict >>> list(keys_to_pfx.keys()) ['Key to prefixes', 'Last updated date'] >>> keys_to_pfx_codes = keys_to_pfx['Key to prefixes'] >>> type(keys_to_pfx_codes) pandas.core.frame.DataFrame >>> keys_to_pfx_codes.head() Prefixes Name 0 CY Wales 1 EA South Eastern: East Anglia area 2 GW Great Western (later known as Western) 3 LN London & North Eastern 4 MD North West: former Midlands lines