Depots.fetch_tops_codes

Depots.fetch_tops_codes(update=False, dump_dir=None, verbose=False)[source]

Fetches the data of two-character TOPS codes.

Parameters:
  • update (bool) – Whether to check for updates to the package data; defaults to False.

  • dump_dir (str | None) – The path to a directory where the data file will be saved; defaults to None.

  • verbose (bool | int) – Whether to print relevant information to the console; defaults to False.

Returns:

A dictionary containing the data of two-character TOPS codes and the date they were last updated.

Return type:

dict

Examples:

>>> from pyrcs.other_assets import Depots  # from pyrcs import Depots
>>> depots = Depots()
>>> tct_codes = depots.fetch_tops_codes()
>>> type(tct_codes)
dict
>>> list(tct_codes.keys())
['Two character TOPS codes', 'Last updated date']
>>> depots.KEY_TO_TOPS
'Two character TOPS codes'
>>> tct_codes_dat = tct_codes[depots.KEY_TO_TOPS]
>>> type(tct_codes_dat)
pandas.core.frame.DataFrame
>>> tct_codes_dat.head()
  Code  ...                Notes
0   AB  ...          Closed 1987
1   AB  ...
2   AC  ...  Became WH from 1994
3   AC  ...
4   AD  ...
[5 rows x 5 columns]