OtherAssets
- class pyrcs.collector.OtherAssets(update=False, verbose=True)[source]
A class representation of all modules of the subpackage
other_assets
for collecting other assets.- Parameters:
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
True
- Variables:
connected (bool) – whether the Internet / the website can be connected
catalogue (dict) – catalogue of the data
SignalBoxes (object) – instance of the class
SignalBoxes
Tunnels (object) – instance of the class
Tunnels
Viaducts (object) – instance of the class
Viaducts
Stations (object) – instance of the class
Stations
Depots (object) – instance of the class
Depots
Features (object) – instance of the class
Features
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
Name of data
URL of the main web page of the data
Methods
update
([confirmation_required, verbose, ...])Update pre-packed data of the other assets.