Survival, Hazard, Regression, Data Science, Hands On Tutorials.
#create a differentiated index based on PRIOR_SURGERY=1 idx = df['PRIOR_SURGERY'] == 1 #Create the respective time series survival_time_with_prior_surgery, survival_status_with_prior_surgery = df.loc[idx, 'SURVIVAL_TIME'], df.loc[idx, 'SURVIVAL_STATUS'] survival_time_without_prior_surgery,