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

XCN_to_FNRN

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

Converts data from XCN format to FNRN format.

Parameters:
  • X (list, array) – The failure or right_censored time.

  • C (list, array) – The censoring code for each X. The default censor codes that will be recognised (not case sensitive) as right censored values are are R, ‘RC’, ‘RIGHT CENS’, ‘RIGHT CENSORED’, ‘C’, ‘CENSORED’, ‘CENS’, ‘S’, ‘SUSP’, ‘SUSPENSION’, ‘SUSPENDED’, ‘UF’, ‘UNFAILED’, ‘UNFAIL’, ‘NF’, ‘NO FAIL’, ‘NO FAILURE’, ‘NOT FAILED’, 1. The default failure codes that will be recognised (not case sensitive) as failures are ‘F’, ‘FAIL’, ‘FAILED’, ‘FAILURE’, 0.

  • N (list, array, optional) – The quantity for each X. If omitted all items are assumed to have quantity (N) of 1.

  • censor_code (str, int, optional) – The censor code you have used if it does not appear in the defaults listed above.

  • failure_code (str, int, optional) – The failure code you have used if it does not appear in the defaults listed above.

Returns:

  • failures (array) – failure times

  • num_failures (array) – the number of failures for each failure time

  • right_censored (array) – right censored times

  • num_right_censored (array) – the number of right censored for each right censored time

Notes

Example usage:

FNRN = XCN_to_FNRN(X=[1,2,3,7,8,9], C=['f','f','f','c','c','c'], N=[1,2,2,3,2,1])
print(FNRN.failures)
   >>> [1 2 3]
print(FNRN.num_failures)
   >>> [1 2 2]
print(FNRN.right_censored)
   >>> [7 8 9]
print(FNRN.num_right_censored)
   >>> [3 2 1]
FNRN.print()
   >>> Data (FNRN format)
       failures  number of failures  right censored  number of right censored
              1                   1               7                         3
              2                   2               8                         2
              3                   2               9                         1
print()

This will print a dataframe of the data in FNRN format to the console

write_to_xlsx(path, **kwargs)

This will export the data in FNRN 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