nr_mileage_num_to_str¶
-
pyrcs.utils.
nr_mileage_num_to_str
(num_mileage)[source]¶ Convert numerical-type Network Rail mileage to string-type one.
- Parameters
num_mileage (float) – numerical-type Network Rail mileage
- Returns
string-type Network Rail mileage in the form ‘<miles>.<yards>’
- Return type
str
Examples:
>>> import numpy as np_ >>> from pyrcs.utils import nr_mileage_num_to_str >>> num_mileage_dat = 0.0396 >>> str_mileage_dat = nr_mileage_num_to_str(num_mileage_dat) >>> print(str_mileage_dat) 0.0396 >>> type(str_mileage_dat) <class 'str'> >>> num_mileage_dat = np_.nan >>> str_mileage_dat = nr_mileage_num_to_str(num_mileage_dat) >>> print(str_mileage_dat) >>> type(str_mileage_dat) <class 'str'>