CaMa survival: no member is followed past today
This commit is contained in:
@@ -103,7 +103,7 @@ def outcome_table(cohort: pd.DataFrame, cutoff, cap_months: int) -> pd.DataFrame
|
||||
frame = _dated(cohort)
|
||||
index = frame.groupby("pac_id")["fecha_indice"].first()
|
||||
death = frame[frame["tipo"] == "defuncion"].groupby("pac_id")["fecha"].min().reindex(index.index)
|
||||
cutoff = pd.Timestamp(cutoff)
|
||||
cutoff = min(pd.Timestamp(cutoff), pd.Timestamp.today().normalize()) # nobody is followed past today
|
||||
died = (death.notna() & (death <= cutoff)).to_numpy()
|
||||
end = death.where(died, cutoff)
|
||||
months = np.floor((end - index).dt.days.to_numpy() / DAYS_PER_MONTH).astype(int).clip(min=0)
|
||||
|
||||
Reference in New Issue
Block a user