2

I try to use pythons lifelines package Package website and Github. After trying to run the example from the website which reads:

from lifelines.datasets import load_waltons
from lifelines import KaplanMeierFitter    
df = load_waltons()
T = df['T']
E = df['E']
kmf = KaplanMeierFitter()
kmf.fit(T, event_observed=E)
kmf.plot()

Resulting in the following error

Traceback (most recent call last):
File "/Kaplan_Meier/Kaplan_Meier.py", line 11, in <module>
kmf.plot()
File "/lib/python3.5/site-packages/lifelines/plotting.py", line 331, in plot
set_kwargs_color(kwargs)
File "/lib/python3.5/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'

I feel like I am missing out on something, but cant really work out, what is going wrong. Any help is appreciated.

The plotting function is wrapped around Pandas and I use python 3.5.4. EDIT: Pandas is version 0.21.0 which should work as 0.18 or above is required according to https://pypi.python.org/pypi/lifelines/0.12.0

4

1 回答 1

1

Update matplotlib to >= 2.0!

If you look at the blame view for the line of code that bugs you, you can see it was last changed when CamDavidsonPilon bumped the required matplotlib version to 2.0 about 3 months ago. In the same commit, he removed some code that supported versions of matplotlib that don't have get_next_color.

于 2017-11-23T14:10:29.010 回答