Python pandas to excel keras results

I have trained a neural network dataset and now I want to export these results to excel file but could not.

import pandas as pd import numpy as np from pandas import ExcelWriter from sklearn.preprocessing import MinMaxScaler from keras.layers.core import Dense from keras.models import Sequential  # read data # create model # train  writer = ExcelWriter('Pandas-Example2.xlsx') df = pd.DataFrame({'observed': output, 'predicted': predictions}) df.to_excel(writer) 

this code throws an exception: ModuleNotFoundError: No module named 'openpyxl'

my output data and predictions data as following:

  • output: [[0], [1], [2]]
  • input : [[2], [1], [3]]

So how can I save this data to excel?