OtherAssets¶
- class pyrcs.collector.OtherAssets(update=False, verbose=True, raise_error=False)[source]¶
A class representation of all modules of the subpackage
other_assets
for collecting the codes of other assets.- Parameters:
update (bool) – Whether to check for updates to the catalogue; defaults to
False
.verbose (bool | int) – Whether to print relevant information to the console; defaults to
True
.raise_error (bool) – Whether to raise the provided exception; if
raise_error=False
(default), the error will be suppressed.
- Variables:
connected (bool) – Whether the Internet / the Railway Codes website is connected.
catalogue (dict) – The catalogue of the data.
SignalBoxes (SignalBoxes) – An instance of the
SignalBoxes
class.Tunnels (Tunnels) – An instance of the
Tunnels
class.Viaducts (Viaducts) – An instance of the
Viaducts
class.Stations (Stations) – An instance of the
Stations
class.Depots (Depots) – An instance of the
Depots
class.Features (Features) – An instance of the
Features
class.HabdWild (HabdWild) – An instance of the
HabdWild
class.WaterTroughs (WaterTroughs) – An instance of the
WaterTroughs
class.Telegraph (Telegraph) – An instance of the
Telegraph
class.Buzzer (Buzzer) – An instance of the
Buzzer
class.
Examples:
>>> from pyrcs import OtherAssets >>> oa = OtherAssets() >>> # To get data of railway stations >>> rail_stn_locations = oa.Stations.fetch_locations() >>> type(rail_stn_locations) dict >>> list(rail_stn_locations.keys()) ['Mileages, operators and grid coordinates', 'Last updated date'] >>> rail_stn_locations_dat = rail_stn_locations[oa.Stations.KEY_TO_STN] >>> type(rail_stn_locations_dat) pandas.core.frame.DataFrame >>> rail_stn_locations_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] >>> # To get data of signal boxes >>> signal_boxes_codes = oa.SignalBoxes.fetch_prefix_codes() >>> type(signal_boxes_codes) dict >>> list(signal_boxes_codes.keys()) ['Signal boxes', 'Last updated date'] >>> signal_boxes_codes_dat = signal_boxes_codes[oa.SignalBoxes.KEY] >>> type(signal_boxes_codes_dat) pandas.core.frame.DataFrame >>> signal_boxes_codes_dat.head() Code Signal Box ... Closed Control to 0 AF Abbey Foregate Junction ... 1 AJ Abbey Junction ... 16 February 1992 Nuneaton (NN) 2 R Abbey Junction ... 16 February 1992 Nuneaton (NN) 3 AW Abbey Wood ... 13 July 1975 Dartford (D) 4 AE Abbey Works East ... 1 November 1987 Port Talbot (PT) [5 rows x 8 columns]
Attributes
The name of the data.
Methods
update
([confirmation_required, verbose, ...])Updates the pre-packed data of the other assets.