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() >>> # tel_codes_dat = features.fetch_telegraph_codes(update=True, verbose=True) >>> tel_codes_dat = features.fetch_telegraph_codes() >>> tel_codes = tel_codes_dat['Telegraphic codes'] >>> type(tel_codes) dict >>> list(tel_codes.keys()) ['Official codes', 'Unofficial codes'] >>> official_codes = tel_codes['Official codes'] >>> type(official_codes) pandas.core.frame.DataFrame >>> print(official_codes.head()) Code ... In use 0 ACACIA ... 'companies', 1939 1 ACK ... BR, 1980s 2 ADEX ... GWR, 1939 BR, 1980s 3 AJAX ... BR, 1980s 4 ALERT ... BR, 1980s [5 rows x 3 columns]