Pandas Excel Writer

Asked

Viewed 1,066 times

2

I have a problem trying to write an excel file with pandas. When I try to write it presents the following message.

ZIP does not support timestamps before 1980

Thinking that could be some problem with the data I created a test file and even then error occurs.

Follow the code below.

import pandas as pd

df = pd.DataFrame([[1,2,3],[4,5,6]],columns=['A','B','C'])

writer=pd.ExcelWriter('teste.xlsx')
df.to_excel(writer,'teste',index=False)
writer.save()

Also follow the full error message:

  writer.save()
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\excel.py",              line 1952, in save
  return self.book.close()
  File "C:\ProgramData\Anaconda3\lib\site-packages\xlsxwriter\workbook.py", line 306, in close
  self._store_workbook()
  File "C:\ProgramData\Anaconda3\lib\site-packages\xlsxwriter\workbook.py", line 679, in _store_workbook
  xlsx_file.write(os_filename, xml_filename)
  File "C:\ProgramData\Anaconda3\lib\zipfile.py", line 1710, in write
  zinfo = ZipInfo.from_file(filename, arcname)
  File "C:\ProgramData\Anaconda3\lib\zipfile.py", line 518, in from_file
  zinfo = cls(arcname, date_time)
  File "C:\ProgramData\Anaconda3\lib\zipfile.py", line 357, in __init__
  raise ValueError('ZIP does not support timestamps before 1980')
  ValueError: ZIP does not support timestamps before 1980
  • the version I was with was 1.1.8 that was with this problem, I managed to solve it by upgrading to 1.1.9, released yesterday.

1 answer

2


This is a bug xlsxwriter, try to upgrade the package to at least version 1.1.4. Anaconda commands:

conda update xlsxwriter

or with Pip:

pip install --upgrade xlsxwriter
  • our - thanks - I was already going to ask in the comments if the A.P. computer clock was correct! :-)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.