https://raw.githubusercontent.com/MatthewReid854/reliability/master/docs/images/logo.png

XCN_to_FR

class reliability.Convert_data.XCN_to_FR(X, C, N=None, censor_code=None, failure_code=None)

XCN_to_FR data format converter

Inputs: X - the failure or right_censored time. This must be an array or list. C - the censoring code for each X. This must be an array or list. Defaults are recognised from the lists shown below. N - the quantity for each X. This must be an array or list. Optional Input. If omitted all items are assumed to have quantity (N) of 1. censor_code - specify the censor code you have used if it does not appear in the defaults (see below). Optional input.

  • default censor codes that will be recognised (not case sensitive): R, ‘RC’, ‘RIGHT CENS’, ‘RIGHT CENSORED’, ‘C’, ‘CENSORED’, ‘CENS’, ‘S’, ‘SUSP’, ‘SUSPENSION’, ‘SUSPENDED’, ‘UF’, ‘UNFAILED’, ‘UNFAIL’, ‘NF’, ‘NO FAIL’, ‘NO FAILURE’, ‘NOT FAILED’, 1
failure_code - specify the failure code you have used if it does not appear in the defaults (see below). Optional Input.
  • default failure codes that will be recognised (not case sensitive): ‘F’, ‘FAIL’, ‘FAILED’, ‘FAILURE’, 0

Output: failures right_censored

Methods: print() - this will print a dataframe of the data in FR format to the console write_to_xlsx() - this will export the data in FR format to an xlsx file at the specified path.

Example usage: FR = XCN_to_FR(X=[1,2,3,7,8,9], C=[‘f’,’f’,’f’,’c’,’c’,’c’], N=[1,2,2,3,2,1]) print(FR.failures)

>>> [1 2 2 3 3]
print(FR.right_censored)
>>> [7 7 7 8 8 9]
FR.print()
>>> Data (FR format)
    failures  right censored
           1               7
           2               7
           2               7
           3               8
           3               8
                           9
print()
write_to_xlsx(path, **kwargs)