LocationIdentifiers.fetch_codes

LocationIdentifiers.fetch_codes(update=False, dump_dir=None, verbose=False)

Fetch CRS, NLC, TIPLOC, STANME and STANOX codes and other systems’ station codes.

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

  • dump_dir (str or None) – pathname of a directory where the data file is dumped, defaults to None

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

Returns

data of location codes 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_codes = lid.fetch_codes()
>>> type(loc_codes)
dict
>>> list(loc_codes.keys())
['LocationID', 'Other systems', 'Additional notes', 'Last updated date']

>>> lid.KEY
'LocationID'

>>> loc_codes_dat = loc_codes[lid.KEY]
>>> type(loc_codes_dat)
pandas.core.frame.DataFrame
>>> loc_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]