4

我试图运行以下代码。但它在 lifelines/plotting.py 文件中给出了参数所需的错误。我无法修复它。

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()

但它给出了以下错误

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'
4

1 回答 1

3

我面临着同样的问题。将生命线
升级到 0.14.0,将matplotlib升级到 2.2.2,并且可以正常工作。

于 2018-03-27T20:56:08.450 回答