lifelines
Survival analysis in Python, including Kaplan Meier, Nelson Aalen and regression
Decision gist · record as of 2026-08-14
Yes. lifelines is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively. It is the standard Python library for survival analysis and well-suited for anyone analyzing time-to-event data with censoring. Install it if you need to fit survival models or estimate event-time distributions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later.
- Low friction: pure Python wheel, active maintenance (last commit 2026-03-07), and modern Python support (3.11+).
- Seven runtime dependencies are all standard scientific packages (numpy, scipy, pandas, matplotlib, autograd, autograd-gamma, formulaic), widely available and well-maintained.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute lifelines with minimal restrictions, making it suitable for both open-source and commercial projects.
last release 2026-03-05 (162 days) · last repo commit 2026-03-07 · 2,604 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,547,917 downloads/mo, #3,006 on PyPI
Alternatives
Verify before relying
pip install lifelines
from lifelines import KaplanMeierFitter
import pandas as pd
kmf = KaplanMeierFitter()
kmf.fit(durations=df['time'], event_observed=df['event'])
kmf.plot_survival_function()- Whether the package supports right-censored, left-censored, and interval-censored data types beyond what the description implies.
- Performance characteristics and scalability limits for large datasets or high-dimensional covariate spaces.
What it is and what it does
lifelines is a pure Python library for survival analysis—a statistical discipline originally developed in medicine and actuarial science to answer when and why events occur under uncertainty. It provides implementations of classical estimators (Kaplan-Meier, Nelson-Aalen) and regression models to analyze time-to-event data, where observations may be censored (incomplete). The library depends on numpy, scipy, pandas, matplotlib, autograd, autograd-gamma, and formulaic to handle numerical computation, data manipulation, visualization, and automatic differentiation.
Beyond medical applications, survival analysis applies to subscriber lifetime measurement in SaaS, inventory stock-outs, political party or relationship lifespans, and A/B testing for time-to-action. lifelines abstracts the mathematical complexity, allowing researchers and data scientists to fit models, estimate survival curves, and test hypotheses on censored data without implementing the algorithms from scratch.
Use it for
- Estimate patient survival curves and test whether treatment groups differ in time-to-event outcomes.
- Measure SaaS subscriber lifetime and identify factors (pricing, features, cohort) that influence churn.
- Analyze A/B test results to determine which variant leads to faster user action completion.
- Study political party or relationship lifespans to understand what factors predict dissolution.
- Quantify inventory demand by treating stock-outs as censoring events in demand estimation.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
lifelines is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively. It is the standard Python library for survival analysis and well-suited for anyone analyzing time-to-event data with censoring. Install it if you need to fit survival models or estimate event-time distributions.
Install
lifelines on PyPI
Before you install
Low friction: pure Python wheel, active maintenance (last commit 2026-03-07), and modern Python support (3.11+). Seven runtime dependencies are all standard scientific packages (numpy, scipy, pandas, matplotlib, autograd, autograd-gamma, formulaic), widely available and well-maintained.
Requires Python 3.11 or later.
License in practice
MIT license is permissive; you can use, modify, and distribute lifelines with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install lifelines
from lifelines import KaplanMeierFitter
import pandas as pd
kmf = KaplanMeierFitter()
kmf.fit(durations=df['time'], event_observed=df['event'])
kmf.plot_survival_function()
Verify before relying
- Whether the package supports right-censored, left-censored, and interval-censored data types beyond what the description implies.
- Performance characteristics and scalability limits for large datasets or high-dimensional covariate spaces.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 7 packagesnumpyscipypandasmatplotlibautogradautograd-gammaformulaic |
| Maintenance | Actively maintained 162 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,547,917 / month, #3,006 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering |
Evidence: lifelines-0.30.3-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “kaplan meier estimator”
- lifelineslifelines implements survival analysis methods—Kaplan-Meier,…
- tensorflow-estimatorTensorFlow Estimator provides a high-level API for building and…
- azureml-train-coreProvides estimator classes for training machine learning models in…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also Lifetimes · reliability · scikit-survival · statsmodels · pymannkendall · pytensor-distributions · linearmodels · yellowbrick · spreg · conda-pack