LocationIdentifiers.collect_codes_by_initial

LocationIdentifiers.collect_codes_by_initial(initial, update=False, verbose=False)[source]

Collects CRS, NLC, TIPLOC, STANME and STANOX codes for a given initial letter.

Parameters:
  • initial (str) – The initial letter (e.g. 'a', 'z') of a location name.

  • update (bool) – Whether to check for updates to the package data; defaults to False.

  • verbose (bool | int) – Whether to print relevant information to the console; defaults to True.

Returns:

A dictionary containing data of locations whose names start with the given initial letter, along with the date of the last update.

Return type:

dict

Examples:

>>> from pyrcs.line_data import LocationIdentifiers
>>> # from pyrcs import LocationIdentifiers
>>> lid = LocationIdentifiers()
>>> loc_a_codes = lid.collect_codes_by_initial(initial='a')
>>> type(loc_a_codes)
dict
>>> list(loc_a_codes.keys())
['A', 'Additional notes', 'Last updated date']
>>> loc_a_codes_dat = loc_a_codes['A']
>>> type(loc_a_codes_dat)
pandas.core.frame.DataFrame
>>> loc_a_codes_dat.head()
                              Location CRS  ... STANME_Note STANOX_Note
0                 1999 Reorganisations      ...
1                                   A1      ...
2                       A463 Traded In      ...
3  A483 Road Scheme Supervisors Closed      ...
4                               Aachen      ...
[5 rows x 12 columns]