FNRN_to_XCN
- class reliability.Convert_data.FNRN_to_XCN(failures, num_failures, right_censored=None, num_right_censored=None, censor_code='C', failure_code='F')
Converts data from FNRN format to XCN format.
- Parameters:
failures (array, list) – The failure times
num_failures (array, list) – The number of failures for each failure time. Length must match length of failures.
right_censored (array, list, optional) – The right censored times
num_right_censored (array, list, optional) – The number of right censored for each right censored time. Length must match length of right_censored.
censor_code (str, int, optional) – The code to use for the censored items. Default is ‘C’
failure_code (str, int, optional) – The code to use for the failed items. Default is ‘F’
- Returns:
X (array) – The event times
C (array) – The censor codes
N (array) – The number of events at each event time
Notes
Example usage:
XCN = FNRN_to_XCN(failures=[1, 2, 3], num_failures=[2, 2, 1], right_censored=[9, 8, 7], num_right_censored=[3, 2, 1]) print(XCN.X) >>> [1. 2. 3. 7. 8. 9.] print(XCN.C) >>> ['F' 'F' 'F' 'C' 'C' 'C'] print(XCN.N) >>> [2 2 1 1 2 3] XCN.print() >>> Data (XCN format) event time censor code number of events 1 F 2 2 F 2 3 F 1 7 C 1 8 C 2 9 C 3
- print()
This will print a dataframe of the data in XCN format to the console
- write_to_xlsx(path, **kwargs)
This will export the data in XCN format to an xlsx file at the specified path.
- Parameters:
path (str) – The file path of the xlsx file to be written
kwargs – Keyword arguments passed directly to pandas