我在 python 中使用 CoxPH 实现生命线包。目前,结果在系数和相关统计数据的表格视图中,可以通过print_summary()看到。这是一个例子
df = pd.DataFrame({'duration': [4, 6, 5, 5, 4, 6],
'event': [0, 0, 0, 1, 1, 1],
'cat': [0, 1, 0, 1, 0, 1]})
cph = CoxPHFitter()
cph.fit(df, duration_col='duration', event_col='event', show_progress=True)
cph.print_summary()
out[]
[Table of results from print_summary()][1]
我怎样才能只获得一致性索引作为数据框或列表。cph.summary 返回主要结果的数据框,即 p 值和 coef,但它不包括一致性索引和其他周围信息。