LocationIdentifiers.collect_codes_by_initial

LocationIdentifiers.collect_codes_by_initial(initial, update=False, verbose=False)

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

Parameters
  • initial (str) – initial letter of station/junction name or certain word for specifying URL

  • update (bool) – whether to do an update check (for the package data), defaults to False

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

Returns

data of locations beginning with the given initial letter and date of when the data was last updated

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                                   A1      ...
1                       A463 Traded In      ...
2  A483 Road Scheme Supervisors Closed      ...
3                               Aachen      ...
4                     AA Holidays S524      ...
[5 rows x 12 columns]