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

xlsx_to_XCN

class reliability.Convert_data.xlsx_to_XCN(path, censor_code_in_xlsx=None, failure_code_in_xlsx=None, censor_code_in_XCN='C', failure_code_in_XCN='F', **kwargs)

Converts data from xlsx format into XCN format. The xlsx format is a Microsoft Excel xlsx file.

Parameters:
  • path (str) – The filepath for the xlsx file. Note that you must prefix this with r to specify it as raw text.

  • censor_code_in_xlsx (str, int optional) – The censor code you have used if it does not appear in the defaults. The default censor codes that will be recognised (not case sensitive) 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

  • failure_code_in_xlsx (str, int, optional) – The failure code you have used if it does not appear in the defaults. The default failure codes that will be recognised (not case sensitive) are ‘F’, ‘FAIL’, ‘FAILED’, ‘FAILURE’, 0

  • censor_code_in_XCN (str, int, optional) – The censor code to be used in XCN format. Default is ‘C’

  • failure_code_in_XCN (str, int, optional) – The failure code to be used in XCN format. Default is ‘F’

Returns:

  • X (array) – event times

  • C (array) – censor codes

  • N (array) – number of events at each event time

Notes

For example usage, please see the online documentation.

The function is expecting the xlsx file to have columns in XCN format. If they are in another format (FR, FNRN) then you will need to use the appropriate function for that format.

A reduced form (XC) is accepted and all values will be assumed to have a quantity (N) of 1.

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