Skip to content

Commit

Permalink
less ambiguous loop index
Browse files Browse the repository at this point in the history
  • Loading branch information
aGuyLearning committed Dec 13, 2024
1 parent 8c3d170 commit b3a7c21
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ehrapy/plot/_survival_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,42 +352,42 @@ def cox_ph_forestplot(
labels = coxph_summary.index
tval = []
ytick = []
for i in range(len(coxph_summary)):
if not np.isnan(coxph_summary[auc_col][i]):
for row_index in range(len(coxph_summary)):
if not np.isnan(coxph_summary[auc_col][row_index]):
if (
(isinstance(coxph_summary[auc_col][i], float))
& (isinstance(coxph_summary["coef lower 95%"][i], float))
& (isinstance(coxph_summary["coef upper 95%"][i], float))
(isinstance(coxph_summary[auc_col][row_index], float))
& (isinstance(coxph_summary["coef lower 95%"][row_index], float))
& (isinstance(coxph_summary["coef upper 95%"][row_index], float))
):
tval.append(
[
round(coxph_summary[auc_col][i], decimal),
round(coxph_summary[auc_col][row_index], decimal),
(
"("
+ str(round(coxph_summary["coef lower 95%"][i], decimal))
+ str(round(coxph_summary["coef lower 95%"][row_index], decimal))
+ ", "
+ str(round(coxph_summary["coef upper 95%"][i], decimal))
+ str(round(coxph_summary["coef upper 95%"][row_index], decimal))
+ ")"
),
]
)
else:
tval.append(
[
coxph_summary[auc_col][i],
coxph_summary[auc_col][row_index],
(
"("
+ str(coxph_summary["coef lower 95%"][i])
+ str(coxph_summary["coef lower 95%"][row_index])
+ ", "
+ str(coxph_summary["coef upper 95%"][i])
+ str(coxph_summary["coef upper 95%"][row_index])
+ ")"
),
]
)
ytick.append(i)
ytick.append(row_index)
else:
tval.append([" ", " "])
ytick.append(i)
ytick.append(row_index)

x_axis_upper_bound = round(((pd.to_numeric(coxph_summary["coef upper 95%"])).max() + 0.1), 2)

Expand Down

0 comments on commit b3a7c21

Please sign in to comment.