diff --git a/pycox/evaluation/eval_surv.py b/pycox/evaluation/eval_surv.py index 5e16753..9ad5d8c 100644 --- a/pycox/evaluation/eval_surv.py +++ b/pycox/evaluation/eval_surv.py @@ -33,7 +33,7 @@ def __init__(self, surv, durations, events, censor_surv=None, censor_durations=N self.censor_surv = censor_surv self.censor_durations = censor_durations self.steps = steps - assert pd.Series(self.index_surv).is_monotonic + assert pd.Series(self.index_surv).is_monotonic_increasing @property def censor_surv(self): diff --git a/pycox/models/cox_time.py b/pycox/models/cox_time.py index 12b9cde..e663d67 100644 --- a/pycox/models/cox_time.py +++ b/pycox/models/cox_time.py @@ -94,7 +94,7 @@ def compute_expg_at_risk(ix, t): [self.duration_col] .loc[lambda x: x <= max_duration] .drop_duplicates(keep='first')) - at_risk_sum = (pd.Series([compute_expg_at_risk(ix, t) for ix, t in times.iteritems()], + at_risk_sum = (pd.Series([compute_expg_at_risk(ix, t) for ix, t in times.items()], index=times.values) .rename('at_risk_sum')) events = (df diff --git a/pycox/models/data.py b/pycox/models/data.py index a89b431..52fbafd 100644 --- a/pycox/models/data.py +++ b/pycox/models/data.py @@ -35,7 +35,7 @@ def make_at_risk_dict(durations): allidx = durations.index.values keys = durations.drop_duplicates(keep='first') at_risk_dict = dict() - for ix, t in keys.iteritems(): + for ix, t in keys.items(): at_risk_dict[t] = allidx[ix:] return at_risk_dict