Depots.collect_pre_tops_codes¶
- Depots.collect_pre_tops_codes(confirmation_required=True, verbose=False, raise_error=False)[source]¶
Collect four-digit pre-TOPS 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 four-digit pre-TOPS codes and the date they were last updated, or
Noneif no data is collected.- Return type:
dict | None
Examples:
>>> from pyrcs.other_assets import Depots # from pyrcs import Depots >>> depots = Depots() >>> fdpt_codes = depots.collect_pre_tops_codes(verbose=True) Proceed with collecting data of "four digit pre-TOPS"? [No]|Yes: yes Collecting the data ... Done. >>> type(fdpt_codes) dict >>> list(fdpt_codes) ['Four digit pre-TOPS', 'Last updated date'] >>> fdpt_codes_dat = fdpt_codes['Four digit pre-TOPS'] >>> type(fdpt_codes_dat) pandas.DataFrame >>> fdpt_codes_dat.shape (950, 4) >>> fdpt_codes_dat.head() Code Depot name Region Main Works site 0 2000 Accrington London Midland False 1 2001 Derby Litchurch Lane London Midland True 2 2003 Blackburn London Midland False 3 2004 Bolton Trinity Street London Midland False 4 2006 Burnley London Midland False