AttributeError:' _process_plot_var_args'对象没有属性' get_next_color'

时间:2018-01-28 06:46:22

标签: python statistics survival-analysis lifelines

我试过运行以下代码。但它在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'

1 个答案:

答案 0 :(得分:3)

我遇到了同样的问题 将生命线升级到0.14.0并将 matplotlib 升级到2.2.2并且它可以正常工作。