5

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()
niranjan
  • 249
  • 3
  • 5
  • 13
  • This is a very detailed post with some great answers on the topic: http://stackoverflow.com/questions/13437727/python-write-to-excel-spreadsheet – winternet Aug 18 '16 at 07:15

0 Answers0