Stations.fetch_locations
- Stations.fetch_locations(update=False, dump_dir=None, verbose=False)
Fetch data of railway station locations (mileages, operators and grid coordinates).
- Parameters
update (bool) – whether to do an update check (for the package data), defaults to
False
dump_dir (str or None) – name of a folder where the pickle file is to be saved, defaults to
None
verbose (bool or int) – whether to print relevant information in console, defaults to
False
- Returns
data of railway station locations 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_location_codes = stn.fetch_locations() >>> type(stn_location_codes) dict >>> list(stn_location_codes.keys()) ['Mileages, operators and grid coordinates', 'Last updated date'] >>> stn.KEY_TO_STN 'Mileages, operators and grid coordinates' >>> stn_location_codes_dat = stn_location_codes[stn.KEY_TO_STN] >>> type(stn_location_codes_dat) pandas.core.frame.DataFrame >>> stn_location_codes_dat.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]