From 1176764ef8eb383723d7d5071cdd79e5f4638f6b Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Fri, 26 Apr 2024 08:17:36 +0200 Subject: [PATCH] Use map not applymap to avoid pandas warnings --- audplot/core/api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/audplot/core/api.py b/audplot/core/api.py index eadacb9..352b0d0 100644 --- a/audplot/core/api.py +++ b/audplot/core/api.py @@ -175,9 +175,9 @@ def confusion_matrix( # Set format of first row labels in confusion matrix if percentage: - annot = cm.applymap(lambda x: f"{100 * x:.0f}%") + annot = cm.map(lambda x: f"{100 * x:.0f}%") else: - annot = cm.applymap(lambda x: human_format(x)) + annot = cm.map(lambda x: human_format(x)) # Add a second row of annotations if requested if show_both: @@ -189,9 +189,9 @@ def confusion_matrix( ) cm2 = pd.DataFrame(cm2, index=labels) if percentage: - annot2 = cm2.applymap(lambda x: human_format(x)) + annot2 = cm2.map(lambda x: human_format(x)) else: - annot2 = cm2.applymap(lambda x: f"{100 * x:.0f}%") + annot2 = cm2.map(lambda x: f"{100 * x:.0f}%") # Combine strings from two dataframes # by vectorizing the underlying function.