Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions audplot/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down