Converting from Seaborn Confusion Matrix to Plotly confusion Matrix

Hello,
I would like to convert this confusion matrix to plotly however I am getting a keyerror. Please help!

cm_df.shape
(5,5)

y_pred.shape
(80,)

y_test.shape
(80,)

import matplotlib.pyplot as plt

#Creating a confusion matrix which compares the y_test and y_pred
cm = confusion_matrix(y_test, y_pred)

cm_df = pd.DataFrame(cm,
index=[‘Loyalist’, ‘Dissatisfied’, ‘High_Maintenance’, ‘Satisfied’, ‘Potential_Loyalist’],
columns = [‘Loyalist’, ‘Dissatisfied’, ‘High_Maintenance’, ‘Satisfied’, ‘Potential_Loyalist’])

plt.figure(figsize=(6,5))
sns.heatmap(cm_df,annot=True)
plt.title(‘Confusion Matrix’)
plt.ylabel(‘Actual values’)
plt.xlabel(‘Predicted values’)
plt.show()

cm

same graph ran in my plotly environment and returned

like this

2- Issue - when I try to convert my matrix to plotly I am getting a key error

import plotly.figure_factory as ff

names = [‘Loyalist’, ‘Dissatisfied’, ‘High_Maintenance’, ‘Satisfied’, ‘Potential_Loyalist’]

fig = ff.create_annotated_heatmap(cm_df, x = names, y = names)
fig.update_layout(yaxis = dict(categoryorder = ‘category descending’))
fig.show()

Please help! thanks

@marlainna456 You passed to the function ff.create_annotated_heatmap() the name of a Data Frame, cm_df, but the definition of this function is this one:
https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/plotly/figure_factory/_annotated_heatmap.py#L50.