For example, I have the following code where I am trying to write array a to excel file
a = array([1, 2, 3])
write_excel(a)
The function that I wrote is as follow:
def write_excel(numpy_array):
workbook = xlsxwriter.Workbook('C:\\Users\\GTS\\Desktop\\Network \\rel.xlsx')
worksheet = workbook.add_worksheet()
for row, data in enumerate(numpy_array):
worksheet.write_row(row, data)
workbook.close()
I received the following error:
Traceback (most recent call last):
File "C:/Users/GTS/PycharmProjects/Rel1/Rel1.py", line 18, in <module>
write_excel(a)
File "C:\Users\GTS\PycharmProjects\Rel1", line 346, in write_excel
worksheet.write_row(row, data)
File "C:\Users\GTS\PycharmProjects\Rel1\venv\lib\site-packages\xlsxwriter\worksheet.py", line 69, in cell_wrapper
return method(self, *args, **kwargs)
TypeError: write_row() missing 1 required positional argument: 'data'