Features.collect_telegraph_codes

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

Collect data of 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

Examples:

>>> from pyrcs.other_assets import Features  # from pyrcs import Features

>>> feats = Features()

>>> tel_codes = feats.collect_telegraph_codes()
To collect data of Telegraphic codes
? [No]|Yes: yes
>>> type(tel_codes)
dict
>>> list(tel_codes.keys())
['Telegraphic codes', 'Last updated date']

>>> feats.KEY_TO_TELEGRAPH
'Telegraphic codes'

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

>>> tel_official_codes = tel_codes_dat['Official codes']
>>> type(tel_official_codes)
pandas.core.frame.DataFrame
>>> tel_official_codes.head()
      Code  ...                               In use
0    ABACK  ...     cross industry term used in 1939
1    ABASE  ...                            GWR, 1939
2  ABREAST  ...  GWR, 1939 / Railway Executive, 1950
3  ABREAST  ...   British Transport Commission, 1958
4   ABSENT  ...                            GWR, 1939
[5 rows x 3 columns]
>>> tel_unofficial_codes = tel_codes_dat['Unofficial codes']
>>> type(tel_unofficial_codes)
pandas.core.frame.DataFrame
>>> tel_unofficial_codes.head()
      Code                             Unofficial description
0  CRANKEX                                      [See KRANKEX]
1  DRUNKEX  Saturday night special train (usually a DMU) t...
2     GYFO    Strongly urge all speed ('Get your finger out')
3  KRANKEX  Special train with interesting routing or trac...
4   MYSTEX  Special excursion going somewhere no one reall...