Features.collect_habds_and_wilds

Features.collect_habds_and_wilds(confirmation_required=True, verbose=False)[source]

Collects codes of HABDs and WILDs from the source web page.

Note

  • HABDs: Hot axle box detectors

  • WILDs: Wheel impact load detectors

Parameters:
  • confirmation_required (bool) – Whether user confirmation is required before proceeding; defaults to True.

  • verbose (bool | int) – Whether to print relevant information to the console; defaults to False.

Returns:

A dictionary containing the codes of HABDs and WILDs and the date they were last updated, or None if no data is collected.

Return type:

dict | None

Examples:

>>> from pyrcs.other_assets import Features  # from pyrcs import Features
>>> feats = Features()
>>> hw_codes = feats.collect_habds_and_wilds()
To collect data of HABD and WILD
? [No]|Yes: yes
>>> type(hw_codes)
dict
>>> list(hw_codes.keys())
['HABD and WILD', 'Last updated date']
>>> feats.KEY_TO_HABD_WILD
'HABD and WILD'
>>> hw_codes_dat = hw_codes[feats.KEY_TO_HABD_WILD]
>>> type(hw_codes_dat)
dict
>>> list(hw_codes_dat.keys())
['HABD', 'WILD']
>>> habd_dat = hw_codes_dat['HABD']
>>> type(habd_dat)
pandas.core.frame.DataFrame
>>> habd_dat.head()
    ELR  ...                                              Notes
0  BAG2  ...
1  BAG2  ...  installed 29 September 1997, later moved to 74...
2  BAG2  ...                             previously at 74m 51ch
3  BAG2  ...                          removed 29 September 1997
4  BAG2  ...           present in 1969, later moved to 89m 00ch
[5 rows x 5 columns]
>>> wild_dat = hw_codes_dat['WILD']
>>> type(wild_dat)
pandas.core.frame.DataFrame
>>> wild_dat.head()
    ELR  ...                                              Notes
0  AYR3  ...
1  BAG2  ...
2  BML1  ...
3  BML1  ...
4  CGJ3  ...  moved to 183m 68ch from 8 September 2018 / mov...
[5 rows x 5 columns]