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)

Converts data from XCN format to FR 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

  • right_censored (array) – right censored times

Notes

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()

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

write_to_xlsx(path, **kwargs)

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