Skip to main content

Create survival curves using kaplanmeier, the log-rank test and making plots.

Project description


PyPI Version License

  • kaplanmeier is Python package to compute the kaplan meier curves, log-rank test, and make the plot instantly. This work is build on the lifelines package.



  • Install kaplanmeier from PyPI (recommended). kaplanmeier is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
  • Distributed under the MIT license.


  • It is advisable to create a new environment. Pgmpy requires an older version of networkx and matplotlib.
conda create -n env_KM python=3.6
conda activate env_KM
pip install matplotlib numpy pandas seaborn lifelines

Quick Start

pip install kaplanmeier
  • Alternatively, install kaplanmeier from the GitHub source:
git clone
cd kaplanmeier
python install

Import kaplanmeier package

import kaplanmeier as km


df = km.example_data()

# Compute survival, censoring, labx)

Make figure with cii_alpha=0.05 (default)


km.plot(out, cmap='Set1', cii_lines=None, cii_alpha=0.05)

km.plot(out, cmap='Set1', cii_lines='line', cii_alpha=0.05)

km.plot(out, cmap=[(1, 0, 1),(0, 1, 1)])

km.plot(out, cmap='Set2')

km.plot(out, cmap='Set2', methodtype='custom')

  • df looks like this:
     time  Died  group
0     485     0      1
1     526     1      2
2     588     1      2
3     997     0      1
4     426     1      1
..    ...   ...    ...
175   183     0      1
176  3196     0      1
177   457     1      2
178  2100     1      1
179   376     0      1

[180 rows x 3 columns]


Please cite kaplanmeier in your publications if this is useful for your research. Here is an example BibTeX entry:

  author={Erdogan Taskesen},




  • All kinds of contributions are welcome!

© Copyright

See LICENSE for details.

Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for kaplanmeier, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size kaplanmeier-0.1.1-py3-none-any.whl (15.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size kaplanmeier-0.1.1.tar.gz (29.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page