绘制 python 图书馆生命线的问题
Plotting issues with python library lifelines
我尝试使用 python 的生命线包 Package website and Github。在尝试 运行 网站上的例子后,上面写着:
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()
导致如下错误
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'
我觉得我错过了什么,但无法真正解决问题。感谢任何帮助。
绘图功能环绕在 Pandas 上,我使用 python 3.5.4。
编辑:Pandas 是 0.21.0 版本,根据 https://pypi.python.org/pypi/lifelines/0.12.0
需要 0.18 或更高版本
更新 matplotlib 至 >= 2.0!
如果您查看 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,他删除了一些支持没有 get_next_color
.
的 matplotlib 版本的代码
我尝试使用 python 的生命线包 Package website and Github。在尝试 运行 网站上的例子后,上面写着:
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()
导致如下错误
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'
我觉得我错过了什么,但无法真正解决问题。感谢任何帮助。
绘图功能环绕在 Pandas 上,我使用 python 3.5.4。 编辑:Pandas 是 0.21.0 版本,根据 https://pypi.python.org/pypi/lifelines/0.12.0
需要 0.18 或更高版本更新 matplotlib 至 >= 2.0!
如果您查看 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,他删除了一些支持没有 get_next_color
.