4

I have tried to run the following code. but it gives an argument required error in lifelines/plotting.py file. i can't fix it .

import pandas as pd
from lifelines.datasets import  load_dd
import matplotlib.pyplot as plt

data = load_dd()

print data.sample(6)

from lifelines import KaplanMeierFitter
kmf = KaplanMeierFitter()

T = data["duration"]
E = data["observed"]
kmf.fit(T, event_observed=E)
kmf.survival_function_.plot()
plt.title('Survival function of political regimes');
kmf.plot()
plt.show()

but it gives the following error

Traceback (most recent call last):   File "/Users/rabindra/PycharmProjects/SurvivalAnalysis/sources/main.py", line 17, in <module>
    kmf.plot()   File "/Library/Python/2.7/site-packages/lifelines/plotting.py", line 331, in plot
    set_kwargs_color(kwargs)   File "/Library/Python/2.7/site-packages/lifelines/plotting.py", line 223, in set_kwargs_color
    kwargs["ax"]._get_lines.get_next_color()) AttributeError: '_process_plot_var_args' object has no attribute 'get_next_color'
Mohamed Thasin ah
  • 10,754
  • 11
  • 52
  • 111
Rabindra Nath Nandi
  • 1,433
  • 1
  • 15
  • 28

1 Answers1

3

I was facing the same issue.
Upgraded lifelines to 0.14.0 and matplotlib to 2.2.2 and it works.

zx485
  • 28,498
  • 28
  • 50
  • 59