Stations.collect_locations_by_initial

Stations.collect_locations_by_initial(initial, update=False, verbose=False)

Collect data of railway station locations (mileages, operators and grid coordinates) for a given initial letter.

Parameters
  • initial (str) – initial letter of locations of the railway station data

  • 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 railway station locations beginning with the given initial letter and date of when the data was last updated

Return type

dict

Examples:

>>> from pyrcs.other_assets import Stations  # from pyrcs import Stations

>>> stn = Stations()

>>> stn_locations_a = stn.collect_locations_by_initial(initial='a')
>>> type(stn_locations_a)
dict
>>> list(stn_locations_a.keys())
['A', 'Last updated date']

>>> stn_locations_a_codes = stn_locations_a['A']
>>> type(stn_locations_a_codes)
pandas.core.frame.DataFrame
>>> stn_locations_a_codes.head()
           Station  ...                                    Former Operator
0       Abbey Wood  ...  London & South Eastern Railway from 1 April 20...
1       Abbey Wood  ...
2             Aber  ...  Keolis Amey Operations/Gweithrediadau Keolis A...
3        Abercynon  ...  Keolis Amey Operations/Gweithrediadau Keolis A...
4  Abercynon North  ...  [Cardiff Railway Company from 13 October 1996 ...

[5 rows x 13 columns]