OtherAssets

class pyrcs.collector.OtherAssets(update=False, verbose=True)[source]

A class representation of all modules of the subpackage pyrcs.other_assets for collecting other assets.

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

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

Examples:

>>> from pyrcs import OtherAssets

>>> oa = OtherAssets()

>>> # To get data of railway stations
>>> railway_station_data = oa.Stations.fetch_station_data()

>>> type(railway_station_data)
<class 'dict'>
>>> print(list(railway_station_data.keys()))
['Railway station data', 'Last updated date']
>>> railway_station_dat = railway_station_data['Railway station data']
>>> print(railway_station_dat.head())
      Station   ELR   Mileage  ... Prev_Date_6 Prev_Operator_7  Prev_Date_7
0  Abbey Wood   NKL  11m 43ch  ...         NaN             NaN          NaN
1  Abbey Wood  XRS3  24.458km  ...         NaN             NaN          NaN
2        Aber   CAR   8m 69ch  ...         NaN             NaN          NaN
3   Abercynon   CAM  16m 28ch  ...         NaN             NaN          NaN
4   Abercynon   ABD  16m 28ch  ...         NaN             NaN          NaN

[5 rows x 25 columns]

>>> # To get data of signal boxes
>>> signal_boxes_data = oa.SignalBoxes.fetch_prefix_codes()
>>> type(signal_boxes_data)
<class 'dict'>
>>> print(list(signal_boxes_data.keys()))
['Signal boxes', 'Last updated date']
>>> signal_boxes_dat = signal_boxes_data['Signal boxes']
>>> print(signal_boxes_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]

Methods

update([confirmation_required, verbose, …])

Update local backup of the other assets data.