WaterTroughs.collect_codes

WaterTroughs.collect_codes(confirmation_required=True, verbose=False, raise_error=False)[source]

Collect codes of water troughs locations from the source web page.

Parameters:
  • confirmation_required (bool) – Whether user confirmation is required; if confirmation_required=True (default), prompts the user for confirmation before proceeding with data collection.

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

  • raise_error (bool) – Whether to raise the provided exception; if raise_error=False (default), the error will be suppressed.

Returns:

A dictionary containing the codes of water trough locations and the date they were last updated.

Return type:

dict | None

Examples:

>>> from pyrcs.other_assets import WaterTroughs  # from pyrcs import WaterTroughs

>>> wt = WaterTroughs()

>>> wt_codes = wt.collect_codes(verbose=True)
To collect data of water troughs?
 [No]|Yes: yes
Collecting the data ... Done.

>>> type(wt_codes)
dict
>>> list(wt_codes)
['Water troughs', 'Last updated date']

>>> wt_codes_dat = wt_codes['Water troughs']
>>> type(wt_codes_dat)
pandas.DataFrame
>>> wt_codes_dat.shape
(99, 6)
>>> wt_codes_dat.head()
     ELR  ... Length (Yard)
0    BEI  ...           NaN
1    BHL  ...        620.00
42  CGJ2  ...        506.67
41  CGJ2  ...        506.67
2   CGJ6  ...        561.00
[5 rows x 6 columns]