How to estimate the Kaplam Meier model.
The KM estimator is estimated by: $$ S(t_i) = \prod_{t\le t_i} \left(1 - \frac{d_i}{n_i}\right) $$ where $d_i$ is the number of deaths at time $t$ and $n_i$ is the number of individuals alive just before $t$.
Given a large enough observation time, the last number of deaths will be equal to $n_i$. At this time point and into the future, the survival function is zero as $\left(1 - \frac{d_i}{n_i}\right)=0$.
data:
df.head()
km = KaplanMeier()
km.fit(df.rename(columns={'duration': 't', 'observed': 'e'}))
km.plot_survival_function();
km.predict(np.array([5, 20, 30, 100]))