SignalBoxes.fetch_non_national_rail_codes

SignalBoxes.fetch_non_national_rail_codes(update=False, pickle_it=False, data_dir=None, verbose=False)

Fetch signal box prefix codes of non-national rail 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 package data folder, defaults to None

  • verbose (bool or int) – whether to print relevant information in console, defaults to False

Returns

signal box prefix codes of non-national rail

Return type

dict

Example:

>>> from pyrcs.other_assets import SignalBoxes

>>> sb = SignalBoxes()

>>> # nnr_codes = sb.fetch_non_national_rail_codes(update=True, verbose=True)
>>> nnr_codes = sb.fetch_non_national_rail_codes()

>>> type(nnr_codes)
dict
>>> list(nnr_codes.keys())
['Non-National Rail', 'Last updated date']

>>> print(sb.NonNationalRailKey)
Non-National Rail

>>> nnr_codes_ = nnr_codes[sb.NonNationalRailKey]

>>> type(nnr_codes_)
dict
>>> list(nnr_codes_.keys())
['Croydon Tramlink signals',
 'Docklands Light Railway signals',
 'Edinburgh Tramway signals',
 'Glasgow Subway signals',
 'London Underground signals',
 'Luas signals',
 'Manchester Metrolink signals',
 'Midland Metro signals',
 'Nottingham Tram signals',
 'Sheffield Supertram signals',
 'Tyne & Wear Metro signals',
 "Heritage, minor and miniature railways and other 'special' signals"]

>>> lu_signals = nnr_codes_['London Underground signals']
>>> type(lu_signals)
list

>>> type(lu_signals[0])
pandas.core.frame.DataFrame
>>> lu_signals[0].head()
  Code  ... Became or taken over by (where known)
0  BMX  ...                                     -
1    A  ...                                     -
2    S  ...                                     -
3    X  ...                                     -
4    R  ...                                     -
[5 rows x 5 columns]