Stations.fetch_station_data¶
-
Stations.
fetch_station_data
(update=False, pickle_it=False, data_dir=None, verbose=False)¶ Fetch data of railway station locations (incl. mileages, operators and grid coordinates) from local backup.
- Parameters
update (bool) – whether to do an update check (for the package data), defaults to
False
pickle_it (bool) – whether to save the data as a pickle file, defaults to
False
data_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
Example:
>>> from pyrcs.other_assets import Stations >>> stn = Stations() >>> # rail_stn_data = stn.fetch_station_data(update=True, verbose=True) >>> rail_stn_data = stn.fetch_station_data() >>> type(rail_stn_data) dict >>> list(rail_stn_data.keys()) ['Mileages, operators and grid coordinates', 'Last updated date'] >>> rail_stn_dat = rail_stn_data[stn.StnKey] >>> type(rail_stn_dat) pandas.core.frame.DataFrame >>> rail_stn_dat.head() Station ELR ... Prev_Operator_6 Prev_Operator_Period_6 0 Abbey Wood XRS3 ... 1 Abbey Wood NKL ... 2 Aber CAR ... 3 Abercynon ABD ... 4 Abercynon CAM ... [5 rows x 30 columns]