LineData

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

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

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

  • ELRMileages (object) – instance of the class ELRMileages

  • Electrification (object) – instance of the class Electrification

  • LocationIdentifiers (object) – instance of the class LocationIdentifiers

  • LOR (object) – instance of the class LOR

  • LineNames (object) – instance of the class LineNames

  • TrackDiagrams (object) – instance of the class TrackDiagrams

  • Bridges (object) – instance of the class Bridges

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

Name of data

URL

URL of the main web page of the data

Methods

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

Update pre-packed of the line data.