--- id: lifelines version: "0.30.3" license: MIT license_treatment: permissive maintenance: active --- # lifelines — Survival analysis in Python, including Kaplan Meier, Nelson Aalen and regression License: permissive · Maintenance: active · Downloads: 2.5M/mo ## 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 above — verify before relying. lifelines implements survival analysis methods—Kaplan-Meier, Nelson-Aalen, and regression models—to estimate time-to-event distributions and identify factors influencing when events occur. 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 pip install lifelines uv add lifelines poetry add lifelines ## Installing lifelines 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. 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() Requires Python 3.11 or later. 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_current - Install friction: low - Maintenance: active - Downloads: 2.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags survival analysis python, kaplan meier estimator, time to event analysis, censored data analysis, nelson aalen estimator, cox regression, lifetime analysis, survival-analysis, time-to-event, statistical-modeling [View on SkillFed](https://skillfed.io/packages/lifelines) · [View on PyPI](https://pypi.org/project/lifelines/)