Features.fetch_telegraph_codes¶
-
Features.
fetch_telegraph_codes
(update=False, pickle_it=False, data_dir=None, verbose=False)¶ Fetch telegraph code words from local backup.
- Parameters
update (bool) – whether to do an update check (for the package data), defaults to
False
pickle_it (bool) – whether to save the data as a pickle file, defaults to
False
data_dir (str or None) – name of a folder where the pickle file is to be saved, defaults to
None
verbose (bool or int) – whether to print relevant information in console, 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() >>> print(features.TelegraphKey) >>> tel_codes = tel_codes_dat[features.TelegraphKey] >>> 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 >>> official_codes.head() Code Description In use 0 ABACK How many of the following vehicles have you on... NaN 1 ABASE Quantity of timber now lying at your station b... GWR, 1939 2 ABREAST When and for what traffic is the following sto... GWR, 1939 3 ABSENT Insert the following omitted from our invoice.... GWR, 1939 4 ACACIA Special train as under left (or leaving) at ..... † >>> unofficial_codes = tel_codes['Unofficial codes'] >>> type(unofficial_codes) pandas.core.frame.DataFrame >>> unofficial_codes.head() Code Unofficial description 0 CRANKEX See KRANKEX 1 DRUNKEX Saturday night special train (usually a DMU) t... 2 KRANKEX Special train with interesting routing or trac... 3 MYSTEX Special excursion going somewhere no one reall... 4 Q-TRAIN Special run for the BTP travelling on local li...