lifelines implements survival analysis in Python with parametric, semi-parametric, and non-parametric models. It handles right, left, and interval censored data and includes plotting helpers.
Overview
lifelines answers time-to-event questions under uncertainty: why an outcome happens now versus later, and which factors associate with longer or shorter lifetimes. It grew from actuarial and medical use cases and applies equally to subscriber churn, inventory censoring, social-science durations, and experiment timing.
The library is written in pure Python with a simple API, easy installation via pip or conda, and built-in plotting for common survival curves and fits. It bundles widely used univariate and regression models, including Cox-style survival regression, plus support for custom and piecewise models.
Documentation walks through quickstarts, model estimation, proportional hazards checking, time-varying covariates, and worked recipes. A discussion channel and issue tracker host community questions and bug reports.
Users import lifelines into notebooks or applications to fit models, predict survival functions, and visualize results without wrapping external statistics engines.
Key features
- Parametric and non-parametric models
- Cox and custom regression
- Right, left, interval censoring
- Built-in plotting methods
- pip and conda installation
- Univariate survival estimators
- Time-varying regression support
- Pure Python implementation
Use cases
- Medical or actuarial survival studies
- SaaS subscriber lifetime analysis
- Churn and retention modeling
- Reliability engineering metrics
- A/B test time-to-action analysis