lifelines (or doing survival analysis in Python)

lifelines (or doing survival analysis in Python)

Lately, I’ve been doing survival analysis.  I’m not an expert but we had a self-learning group based on David G. Kleinbaum and Mitchel Klein’s  book,   “Survival Analysis. A Self-Learning Text” .  At the end of this book, there’s code provided to help you get started in SAS, Stata, SPSS and… R!  I’ve played with the R package survival which is quite good!  My problem was that I wanted to do survival analysis in Python.  I’ve started by doing it with RPy2 which is a binding for R in python.  It is quite cool and it works with the binding for the python pandas data frame which I use to structure my data in Python.   It was working well but this kind of code is hard to read and to maintain.   

Then I came across Cameron Davidson-Pilon lifelines packages.  It’s a survival analysis package for Python written in Python.  No need to pass data between R and Python anymore. Kaplan-Meier curve are easily done.


Even if the Cox Proprotional Hazard is not implemented yet (Cameron said it was on his to-do list), it’s worth giving it a try!  


[2014-06-09] : Cox Proportional Hazard is now available in lifelines (version 0.4)!
By |2017-04-29T17:16:41+00:00March 24, 2014|Categories: Data Analysis, Python, Statistics|Tags: |0 Comments

About the Author:

I’ve started in biochemistry but it is as a bioinformatician that I’ve been having fun for several years now : whether doing data analysis and visualization in R, building interactive web interfaces in javascript or exploring machine learning in python.

Leave A Comment