OtherAssets

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

A class representation of all modules of the subpackage pyrcs.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

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)
dict
>>> list(railway_station_data.keys())
['Railway station data', 'Last updated date']

>>> railway_station_dat = railway_station_data[oa.Stations.StnKey]

>>> type(railway_station_dat)
pandas.core.frame.DataFrame
>>> railway_station_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]

>>> # To get data of signal boxes
>>> signal_boxes_data = oa.SignalBoxes.fetch_prefix_codes()

>>> type(signal_boxes_data)
dict
>>> list(signal_boxes_data.keys())
['Signal boxes', 'Last updated date']

>>> signal_boxes_dat = signal_boxes_data[oa.SignalBoxes.Key]

>>> 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.