How to export result in excel file? I tried below script but its not giving meproper output. In the case where there is no dependent label present in predicted column and the class which is present in test data set it is not showing it in the output.
Is there any other way to achieve this. I want to present model result in the excel format.
import pandas as pd
expected = y_test
y_actu = pd.Series(expected, name='Actual')
y_pred = pd.Series(predicted, name='Predicted')
df_confusion = pd.crosstab(y_actu, y_pred,y_test.unique())
df_confusion
df_confusion.to_csv('SVM_Confusion_Matrix.csv')
from pandas import ExcelWriter
writer = ExcelWriter('SVM_Confusion_Matrix.xlsx')
df_confusion.to_excel(writer,'Sheet1')
writer.save()