class_docstr: Helper class to construct structured array of event indicator and observed time.
docstr: 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 : np.array
      Structured array with two fields.
docstr_tok: ["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",":","np.array","Structured","array","with","two","fields","."]
code: def 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 : np.array
          Structured array with two fields.
      """
      name_event = name_event or "event"
      name_time = name_time or "time"
      if name_time == name_event:
          raise ValueError(
              "name_time must be different from name_event"
          )
  
      time = np.asanyarray(time, dtype=float)
      y = np.empty(
          time.shape[0], dtype=[(name_event, bool), (name_time, float)]
      )
      y[name_time] = time
  
      event = np.asanyarray(event)
      check_consistent_length(time, event)
  
      if np.issubdtype(event.dtype, np.bool_):
          y[name_event] = event
      else:
          events = np.unique(event)
          events.sort()
          if len(events) != 2:
              raise ValueError("event indicator must be binary")
  
          if np.all(events == np.array([0, 1], dtype=events.dtype)):
              y[name_event] = event.astype(bool)
          else:
              raise ValueError(
                  "non-boolean event indicator must contain 0 and 1 only"
              )
  
      return y
  
file_path: scikit-survival/sksurv/util.py
imports: import numpy
  import pandas
  from pandas.api.types import CategoricalDtype
  from sklearn.utils import check_array, check_consistent_length
label_desc: Use image node_id 1 for calling the Surv obj's underlying member method code with example usage: obj.from_arrays(event, time, name_event, name_time) and returns: y