Stations.collect_station_data_by_initial

Stations.collect_station_data_by_initial(initial, update=False, verbose=False)[source]

Collect railway station data for the given initial letter.

Parameters
  • initial (str) – initial letter of station data (including the station name, ELR, mileage, status, owner, operator, degrees of longitude and latitude, and grid reference) for specifying URL

  • update (bool) – whether to check on update and proceed to update the package data, defaults to False

  • verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to False

Returns

railway station data for the given initial letter and date of when the data was last updated

Return type

dict

Example:

>>> from pyrcs.other_assets import Stations

>>> stn = Stations()

>>> # sa = stn.collect_station_data_by_initial('a', update=True, verbose=True)
>>> sa = stn.collect_station_data_by_initial(initial='a')

>>> type(sa)
dict
>>> list(sa.keys())
['A', 'Last updated date']

>>> print(sa['A'].head())
           Station   ELR  ... Prev_Operator_6 Prev_Operator_Period_6
0       Abbey Wood   NKL  ...            None                   None
1       Abbey Wood  XRS3  ...            None                   None
2             Aber   CAR  ...            None                   None
3  Abercynon North   ABD  ...            None                   None
4                    ABD  ...            None                   None
[5 rows x 28 columns]