Features.fetch_telegraph_codes¶
-
Features.
fetch_telegraph_codes
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch telegraph code words from local backup.
- Parameters
update (bool) – whether to check on update and proceed to update the package data, defaults to
False
pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to
False
data_dir (str or None) – name of package data folder, defaults to
None
verbose (bool) – whether to print relevant information in console as the function runs, defaults to
False
- Returns
data of telegraph code words, and date of when the data was last updated
- Return type
dict
Example:
>>> from pyrcs.other_assets import Features >>> features = Features() >>> telegraph_codes_dat = features.fetch_telegraph_codes() >>> telegraph_codes = telegraph_codes_dat['Telegraphic codes'] >>> type(telegraph_codes) <class 'dict'> >>> print(list(telegraph_codes.keys())) ['Official codes', 'Unofficial codes'] >>> official_codes = telegraph_codes['Official codes'] >>> type(official_codes) <class 'pandas.core.frame.DataFrame'> >>> print(official_codes.head()) Code ... In use 0 ACK ... BR, 1980s 1 ADEX ... GWR, 1939 BR, 1980s 2 AJAX ... BR, 1980s 3 ALERT ... BR, 1980s 4 AMBER ... BR, 1980s [5 rows x 3 columns]