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

FR_to_XCN

class reliability.Convert_data.FR_to_XCN(failures, right_censored=None, censor_code='C', failure_code='F')

Converts data from FR format to XCN format.

Parameters:
  • failures (array, list) – The failure times

  • right_censored (array, list, optional) – The right censored times

  • 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 = FR_to_XCN(failures=[1,1,2,2,3], right_censored=[9,9,9,9,8,8,7])
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 4]
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                 4
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