LineData

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

A class representation of all modules of the subpackage line_data for collecting the codes of line data.

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

  • ELRMileages (ELRMileages) – An instance of the ELRMileages class.

  • Electrification (Electrification) – An instance of the Electrification class.

  • LocationIdentifiers (LocationIdentifiers) – An instance of the LocationIdentifiers class.

  • LOR (LOR) – An instance of the LOR class.

  • LineNames (LineNames) – An instance of the LineNames class.

  • TrackDiagrams (TrackDiagrams) – An instance of the TrackDiagrams class.

  • Bridges (Bridges) – An instance of the Bridges class.

Examples:

>>> from pyrcs import LineData
>>> ld = LineData()
>>> # To get data of location codes
>>> location_codes = ld.LocationIdentifiers.fetch_codes()
>>> type(location_codes)
dict
>>> list(location_codes.keys())
['LocationID', 'Other systems', 'Additional notes', 'Last updated date']
>>> location_codes_dat = location_codes[ld.LocationIdentifiers.KEY]
>>> type(location_codes_dat)
pandas.core.frame.DataFrame
>>> location_codes_dat.head()
                               Location CRS  ... STANME_Note STANOX_Note
0                                Aachen      ...
1                    Abbeyhill Junction      ...
2                 Abbeyhill Signal E811      ...
3            Abbeyhill Turnback Sidings      ...
4  Abbey Level Crossing (Staffordshire)      ...
[5 rows x 12 columns]
>>> # To get data of line names
>>> line_names_codes = ld.LineNames.fetch_codes()
>>> type(line_names_codes)
dict
>>> list(line_names_codes.keys())
['Line names', 'Last updated date']
>>> line_names_codes_dat = line_names_codes[ld.LineNames.KEY]
>>> type(line_names_codes_dat)
pandas.core.frame.DataFrame
>>> line_names_codes_dat.head()
             Line name  ... Route_note
0           Abbey Line  ...       None
1        Airedale Line  ...       None
2          Argyle Line  ...       None
3     Arun Valley Line  ...       None
4  Atlantic Coast Line  ...       None
[5 rows x 3 columns]

Attributes

NAME

The name of the data.

Methods

update([confirmation_required, verbose, ...])

Updates the pre-packed line data.