Features.collect_telegraph_codes

Features.collect_telegraph_codes(confirmation_required=True, verbose=False)

Collect telegraph code words from source web page.

Parameters
  • confirmation_required (bool) – whether to confirm before proceeding, defaults to True

  • 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 or None

Example:

>>> from pyrcs.other_assets import Features

>>> features = Features()

>>> tel_codes_dat = features.collect_telegraph_codes()
To collect data of telegraphic codes? [No]|Yes: yes

>>> type(tel_codes_dat)
dict
>>> list(tel_codes_dat.keys())
['Telegraphic codes', 'Last updated date']

>>> print(features.TelegraphKey)
Telegraphic codes

>>> tel_codes = tel_codes_dat[features.TelegraphKey]

>>> type(tel_codes)
dict
>>> list(tel_codes.keys())
['Official codes', 'Unofficial codes']

>>> tel_codes['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 .....          †

>>> tel_codes['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...