From 02bc8b505f13d817a70bc5d98b9cff938378e6de Mon Sep 17 00:00:00 2001 From: JHogenboom Date: Tue, 1 Oct 2024 13:47:52 +0200 Subject: [PATCH] hotfix for in UI-visuals --- coxph/central.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/coxph/central.py b/coxph/central.py index 4672e3e..444ba89 100644 --- a/coxph/central.py +++ b/coxph/central.py @@ -261,7 +261,7 @@ def central( results["upper_CI"] = np.around(np.exp(results["Coef"] + 1.96 * results["SE"]), 5) results["Z"] = zvalues results["p-value"] = pvalues - results = results.set_index("Var") + results = results[['Var'] + [col for col in results.columns if col != 'Var']] if baseline_hf: # Compute the cumulative baseline hazard and survival function @@ -270,8 +270,11 @@ def central( unique_time_events, summed_agg1) return {"included_organizations": ids, "excluded_organizations": excluded_ids, - "cumulative_baseline_hazard": cumulative_hazard.to_json(), - "baseline_survival_function": survival_function.to_json(), + # TODO remove this workaround as soon as .to_json() is supported for line plots + "cumulative_baseline_hazard": cumulative_hazard.to_dict(), + "baseline_survival_function": survival_function.to_dict(), + # "cumulative_baseline_hazard": cumulative_hazard.to_json(), + # "baseline_survival_function": survival_function.to_json(), "coxph_results": results.to_json() }