sksurv.util.Surv

class sksurv.util.Surv

Helper class to construct structured array of event indicator and observed time.

__init__()

Initialize self. See help(type(self)) for accurate signature.

Methods

from_arrays(event, time[, name_event, name_time]) Create structured array.
from_dataframe(event, time, data) Create structured array from data frame.
static from_arrays(event, time, name_event=None, name_time=None)

Create structured array.

Parameters:
  • event (array-like) – Event indicator. A boolean array or array with values 0/1.
  • time (array-like) – Observed time.
  • name_event (str|None) – Name of event, optional, default: ‘event’
  • name_time (str|None) – Name of observed time, optional, default: ‘time’
Returns:

y – Structured array with two fields.

Return type:

np.array

static from_dataframe(event, time, data)

Create structured array from data frame.

Parameters:
  • event (object) – Identifier of column containing event indicator.
  • time (object) – Identifier of column containing time.
  • data (pandas.DataFrame) – Dataset.
Returns:

y – Structured array with two fields.

Return type:

np.array