class_docstr: Class for fitting the Kaplan-Meier estimate for the survival function.
  
  Parameters
  ----------
  alpha: float, optional (default=0.05)
      The alpha value associated with the confidence intervals.
  label: string, optional
      Provide a new label for the estimate - useful if looking at many groups.
  
  Examples
  --------
  .. code:: python
  
      from lifelines import KaplanMeierFitter
      from lifelines.datasets import load_waltons
      waltons = load_waltons()
  
      kmf = KaplanMeierFitter(label="waltons_data")
      kmf.fit(waltons['T'], waltons['E'])
      kmf.plot()
  
  
  Attributes
  ----------
  survival_function_ : DataFrame
      The estimated survival function (with custom timeline if provided)
  median_survival_time_ : float
      The estimated median time to event. np.inf if doesn't exist.
  confidence_interval_ : DataFrame
      The lower and upper confidence intervals for the survival function. An alias of
      ``confidence_interval_survival_function_``. Uses Greenwood's Exponential formula ("log-log" in R).
  confidence_interval_survival_function_ : DataFrame
      The lower and upper confidence intervals for the survival function. An alias of
      ``confidence_interval_``. Uses Greenwood's Exponential formula ("log-log" in R).
  cumulative_density_ : DataFrame
      The estimated cumulative density function (with custom timeline if provided)
  confidence_interval_cumulative_density_ : DataFrame
      The lower and upper confidence intervals for the cumulative density.
  durations: array
      The durations provided
  event_observed: array
      The event_observed variable provided
  timeline: array
      The time line to use for plotting and indexing
  entry: array or None
      The entry array provided, or None
  event_table: DataFrame
      A summary of the life table
docstr: Fit the model to a right-censored dataset
  
  Parameters
  ----------
    durations: an array, list, pd.DataFrame or pd.Series
      length n -- duration (relative to subject's birth) the subject was alive for.
    event_observed: an array, list, pd.DataFrame, or pd.Series, optional
       True if the the death was observed, False if the event was lost (right-censored). Defaults all True if event_observed==None
    timeline: an array, list, pd.DataFrame, or pd.Series, optional
      return the best estimate at the values in timelines (positively increasing)
    entry: an array, list, pd.DataFrame, or pd.Series, optional
       relative time when a subject entered the study. This is useful for left-truncated (not left-censored) observations. If None, all members of the population
       entered study when they were "born".
    label: string, optional
      a string to name the column of the estimate.
    alpha: float, optional
      the alpha value in the confidence intervals. Overrides the initializing alpha for this call to fit only.
    ci_labels: tuple, optional
          add custom column names to the generated confidence intervals as a length-2 list: [<lower-bound name>, <upper-bound name>]. Default: <label>_lower_<1-alpha/2>
    weights: an array, list, pd.DataFrame, or pd.Series, optional
        if providing a weighted dataset. For example, instead
        of providing every subject as a single element of `durations` and `event_observed`, one could
        weigh subject differently.
    fit_options:
      Not used in KaplanMeierFitter
  
  Returns
  -------
  self: KaplanMeierFitter
    self with new properties like ``survival_function_``, ``plot()``, ``median_survival_time_``
docstr_tok: ["Fit","the","model","to","a","right-censored","dataset","Parameters","--","--","--","--","--","durations",":","an","array",",","list",",","pd.DataFrame","or","pd.Series","length","n","--","duration","(","relative","to","subject","'s","birth",")","the","subject","was","alive","for",".","event_observed",":","an","array",",","list",",","pd.DataFrame",",","or","pd.Series",",","optional","True","if","the","the","death","was","observed",",","False","if","the","event","was","lost","(","right-censored",")",".","Defaults","all","True","if","event_observed==None","timeline",":","an","array",",","list",",","pd.DataFrame",",","or","pd.Series",",","optional","return","the","best","estimate","at","the","values","in","timelines","(","positively","increasing",")","entry",":","an","array",",","list",",","pd.DataFrame",",","or","pd.Series",",","optional","relative","time","when","a","subject","entered","the","study",".","This","is","useful","for","left-truncated","(","not","left-censored",")","observations",".","If","None",",","all","members","of","the","population","entered","study","when","they","were","``","born","''",".","label",":","string",",","optional","a","string","to","name","the","column","of","the","estimate",".","alpha",":","float",",","optional","the","alpha","value","in","the","confidence","intervals",".","Overrides","the","initializing","alpha","for","this","call","to","fit","only",".","ci_labels",":","tuple",",","optional","add","custom","column","names","to","the","generated","confidence","intervals","as","a","length-2","list",":","[","<","lower-bound","name",">",",","<","upper-bound","name",">","]",".","Default",":","<","label",">","_lower_","<","1-alpha\/2",">","weights",":","an","array",",","list",",","pd.DataFrame",",","or","pd.Series",",","optional","if","providing","a","weighted","dataset",".","For","example",",","instead","of","providing","every","subject","as","a","single","element","of","`","durations","`","and","`","event_observed","`",",","one","could","weigh","subject","differently",".","fit_options",":","Not","used","in","KaplanMeierFitter","Returns","--","--","--","-","self",":","KaplanMeierFitter","self","with","new","properties","like","``","survival_function_","``",",","``","plot","(",")","``",",","``","median_survival_time_","``"]
code: def fit(
      self,
      durations,
      event_observed=None,
      timeline=None,
      entry=None,
      label=None,
      alpha=None,
      ci_labels=None,
      weights=None,
      fit_options=None,
  ):  # pylint: disable=too-many-arguments,too-many-locals
      """
      Fit the model to a right-censored dataset
  
      Parameters
      ----------
        durations: an array, list, pd.DataFrame or pd.Series
          length n -- duration (relative to subject's birth) the subject was alive for.
        event_observed: an array, list, pd.DataFrame, or pd.Series, optional
           True if the the death was observed, False if the event was lost (right-censored). Defaults all True if event_observed==None
        timeline: an array, list, pd.DataFrame, or pd.Series, optional
          return the best estimate at the values in timelines (positively increasing)
        entry: an array, list, pd.DataFrame, or pd.Series, optional
           relative time when a subject entered the study. This is useful for left-truncated (not left-censored) observations. If None, all members of the population
           entered study when they were "born".
        label: string, optional
          a string to name the column of the estimate.
        alpha: float, optional
          the alpha value in the confidence intervals. Overrides the initializing alpha for this call to fit only.
        ci_labels: tuple, optional
              add custom column names to the generated confidence intervals as a length-2 list: [<lower-bound name>, <upper-bound name>]. Default: <label>_lower_<1-alpha/2>
        weights: an array, list, pd.DataFrame, or pd.Series, optional
            if providing a weighted dataset. For example, instead
            of providing every subject as a single element of `durations` and `event_observed`, one could
            weigh subject differently.
        fit_options:
          Not used in KaplanMeierFitter
  
      Returns
      -------
      self: KaplanMeierFitter
        self with new properties like ``survival_function_``, ``plot()``, ``median_survival_time_``
  
      """
  
      return self._fit(
          durations,
          event_observed,
          timeline,
          entry,
          label,
          alpha,
          ci_labels,
          weights,
      )
  
imports: from __future__ import annotations
  import warnings
  import numpy
  import pandas
  import typing
  from lifelines.fitters import NonParametricUnivariateFitter
  from lifelines.exceptions import StatError, StatisticalWarning
  from lifelines.utils import _preprocess_inputs, _additive_estimate, _to_1d_array, inv_normal_cdf, median_survival_times, qth_survival_time, check_nans_or_infs, coalesce, CensoringType, pass_for_numeric_dtypes_or_raise_array, check_nans_or_infs
  from lifelines.plotting import loglogs_plot, _plot_estimate
  from lifelines.fitters.npmle import npmle, reconstruct_survival_function, npmle_compute_confidence_intervals
label_desc: Use image node_id 1 for calling the KaplanMeierFitter obj's underlying member method code with example usage: obj.fit(durations, event_observed, timeline, entry, label, alpha, ci_labels, weights, fit_options) and returns: self