I have been working through Hilpisch's "Python for Finance" and haven't had much trouble until I got to the chapter on writing to Excel. I am running Python 3.5 and using the OpenPyxl module
import openpyxl as oxl
import numpy as np
wb = oxl.Workbook()
ws = wb.create_sheet(index = 0, title = 'oxl_sheet')
data = np.arange(1, 65).reshape((8, 8))
for c in range(1, data.shape[0]):
for r in range(1, data.shape[1]):
ws.cell(row=r, column=c, value=data[c, r])
This returns: ValueError: Cannot convert 10 to Excel
Is it an issue with using numpy? For example, the following code returns a similar error.
ws.cell(row=1, column=1, value=data[0,0])
But replacing data[0, 0] with an integer or float raises no problem.
Seems like there should be an easy fix to this.