<p dir="auto">I'm using pandas version '0.7.0rc1' with Python 2.7.2 on Windows XP.</p>
<p dir="auto">When writing HDF files, pandas tries to convert datetime index values to an ordinal using time.mktime.  mktime does not support any dates before 1969.</p>
<p dir="auto">error output shows the offending line to be:</p>
<blockquote>
<p dir="auto">File "C:\Python27\lib\site-packages\pandas\io\pytables.py", line 697, in _convert_index<br>
converted = np.array([time.mktime(v.timetuple()) for v in values],</p>
</blockquote>
<p dir="auto">I suggest datetime.toordinal() instead of time.mktime().   However, doing so break existing HDF files.</p>
<p dir="auto">test program to demonstrate the problem</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas
import numpy

newIndex = pandas.DateRange('1/1/2000', periods=8)

newDF = pandas.DataFrame(numpy.random.randn(8, 3), index=newIndex,
               columns=['A', 'B', 'C'])

oldIndex = pandas.DateRange('1/1/1950', periods=8)

oldDF = pandas.DataFrame(numpy.random.randn(8, 3), index=oldIndex,
               columns=['A', 'B', 'C'])

store = pandas.io.pytables.HDFStore('store.h5')
print '--- writing new ---'
store['newDF'] = newDF

print '--- writing old ---'
store['oldDF'] = oldDF

print 'done'"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span>

<span class="pl-s1">newIndex</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-v">DateRange</span>(<span class="pl-s">'1/1/2000'</span>, <span class="pl-s1">periods</span><span class="pl-c1">=</span><span class="pl-c1">8</span>)

<span class="pl-s1">newDF</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">numpy</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">8</span>, <span class="pl-c1">3</span>), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">newIndex</span>,
               <span class="pl-s1">columns</span><span class="pl-c1">=</span>[<span class="pl-s">'A'</span>, <span class="pl-s">'B'</span>, <span class="pl-s">'C'</span>])

<span class="pl-s1">oldIndex</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-v">DateRange</span>(<span class="pl-s">'1/1/1950'</span>, <span class="pl-s1">periods</span><span class="pl-c1">=</span><span class="pl-c1">8</span>)

<span class="pl-s1">oldDF</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">numpy</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">8</span>, <span class="pl-c1">3</span>), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">oldIndex</span>,
               <span class="pl-s1">columns</span><span class="pl-c1">=</span>[<span class="pl-s">'A'</span>, <span class="pl-s">'B'</span>, <span class="pl-s">'C'</span>])

<span class="pl-s1">store</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-s1">io</span>.<span class="pl-s1">pytables</span>.<span class="pl-v">HDFStore</span>(<span class="pl-s">'store.h5'</span>)
<span class="pl-k">print</span> <span class="pl-s">'--- writing new ---'</span>
<span class="pl-s1">store</span>[<span class="pl-s">'newDF'</span>] <span class="pl-c1">=</span> <span class="pl-s1">newDF</span>

<span class="pl-k">print</span> <span class="pl-s">'--- writing old ---'</span>
<span class="pl-s1">store</span>[<span class="pl-s">'oldDF'</span>] <span class="pl-c1">=</span> <span class="pl-s1">oldDF</span>

<span class="pl-k">print</span> <span class="pl-s">'done'</span></pre></div>
<p dir="auto">I am having trouble with pre-epoch dates working with HDFStore, getting an OverflowError in mktime, as shown below.</p>
<p dir="auto">Sample code is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    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()"><pre class="notranslate"><code class="notranslate">    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()
</code></pre></div>
<p dir="auto">The error I get is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    Traceback (most recent call last):
      File &quot;C:\Users\Salman Ansari\Documents\Python\VAR\src\bugzilla.py&quot;, line 27, in &lt;module&gt;
        panda_test()
      File &quot;C:\Users\Salman Ansari\Documents\Python\VAR\src\bugzilla.py&quot;, line 22, in panda_test
        store['df'] = df
      File &quot;C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py&quot;, line 122, in __setitem__
        self.put(key, value)
      File &quot;C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py&quot;, line 260, in put
        comp=compression)
      File &quot;C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py&quot;, line 327, in _write_to_group
        wrapper(value)
      File &quot;C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py&quot;, line 325, in &lt;lambda&gt;
        wrapper = lambda value: handler(group, value)
      File &quot;C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py&quot;, line 335, in _write_frame
        self._write_block_manager(group, df._data)
      File &quot;C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py&quot;, line 346, in _write_block_manager
        self._write_index(group, 'axis%d' % i, ax)
      File &quot;C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py&quot;, line 432, in _write_index
        converted, kind, _ = _convert_index(index)
      File &quot;C:\Python27\lib\site-packages\pandas-0.4.0-py2.7-win32.egg\pandas\io\pytables.py&quot;, 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"><pre class="notranslate"><code class="notranslate">    Traceback (most recent call last):
      File "C:\Users\Salman Ansari\Documents\Python\VAR\src\bugzilla.py", line 27, in &lt;module&gt;
        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 &lt;lambda&gt;
        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
</code></pre></div>
<p dir="auto">Any ideas, please?</p>