Skip to main content

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

Project description

kaplanmeier

Python PyPI Version License Github Forks GitHub Open Issues Project Status Downloads Downloads

kaplanmeier is a Python package to compute the kaplan meier curves, log-rank test, and make the plots.

Star this repo if you like it! ⭐️

Installation

pip install kaplanmeier

Import kaplanmeier package

import kaplanmeier as km

Example:

df = km.example_data()
time_event=df['time']
censoring=df['Died'] 
labx=df['group']

# Compute survival
out=km.fit(time_event, censoring, labx)

Make figure with cii_alpha=0.05 (default)

km.plot(out)

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]

Citation

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

@misc{erdogant2019kaplanmeier,
  title={kaplanmeier},
  author={Erdogan Taskesen},
  year={2019},
  howpublished={\url{https://github.com/erdogant/kaplanmeier}},
}

References

Maintainer

  • Erdogan Taskesen, github: erdogant
  • Contributions are welcome.
  • If you wish to buy me a Coffee for this work, it is very appreciated :)

Project details


Download files

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

Source Distribution

kaplanmeier-0.1.5.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kaplanmeier-0.1.5-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file kaplanmeier-0.1.5.tar.gz.

File metadata

  • Download URL: kaplanmeier-0.1.5.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for kaplanmeier-0.1.5.tar.gz
Algorithm Hash digest
SHA256 603b2521152b64c911864ba1432fe73dc12a78cabbfbadfcf70375a5200c6573
MD5 f97cd58b6f8eeeab1d5b0d841cacb556
BLAKE2b-256 ad9fa8e4a93481d98284b20d69760fee636db343d10291bc4e770e2c955805be

See more details on using hashes here.

File details

Details for the file kaplanmeier-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: kaplanmeier-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for kaplanmeier-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1bf9f3a395e51625a1b527cb68fe2d8fe13733e93116876695d9b6c3328ef906
MD5 a798ef1b9fa2c34e9a9892b8852a189b
BLAKE2b-256 82c67290af52e59885ae7d5cb4112f9500e06cd9f0041837486bfd12ffc1b112

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page