-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
Milestone
Description
I am having trouble with pre-epoch dates working with HDFStore, getting an OverflowError in mktime, as shown below.
Sample code is:
import numpy as np
from pandas import *
def panda_test():
# generate some data
data = np.random.rand(50,5)
# generate some dates
dates = DateRange('1/1/1969',periods=50)
# generate column headings
cols = ['A','B','C','D','E']
df = DataFrame(data,index=dates,columns=cols)
# save to HDF5Store
store = HDFStore('bugzilla.h5', mode='w')
store['df'] = df # This gives: OverflowError: mktime argument out of range
store.close()
if __name__ == '__main__':
panda_test()
The error I get is:
Traceback (most recent call last):
File "C:\Users\Salman Ansari\Documents\Python\VAR\src\bugzilla.py", line 27, in <module>
panda_test()
File "C:\Users\Salman Ansari\Documents\Python\VAR\src\bugzilla.py", line 22, in panda_test
store['df'] = df
File "C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py", line 122, in __setitem__
self.put(key, value)
File "C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py", line 260, in put
comp=compression)
File "C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py", line 327, in _write_to_group
wrapper(value)
File "C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py", line 325, in <lambda>
wrapper = lambda value: handler(group, value)
File "C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py", line 335, in _write_frame
self._write_block_manager(group, df._data)
File "C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py", line 346, in _write_block_manager
self._write_index(group, 'axis%d' % i, ax)
File "C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py", line 432, in _write_index
converted, kind, _ = _convert_index(index)
File "C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py", line 698, in _convert_index
for v in values], dtype=np.int64)
OverflowError: mktime argument out of range
Closing remaining open files: bugzilla.h5... done
Any ideas, please?