<p dir="auto"><a href="http://stackoverflow.com/questions/18646668/pandas-hdfstore-duplicate-items-error/18668217#18668217" rel="nofollow">http://stackoverflow.com/questions/18646668/pandas-hdfstore-duplicate-items-error/18668217#18668217</a></p>
<p dir="auto">from <a href="http://stackoverflow.com/questions/11991627/selecting-a-subset-of-a-pandas-dataframe-indexed-by-datetimeindex-with-a-list-of" rel="nofollow">stackoverflow</a></p>
<p dir="auto">The original frame can not be shared, but following code reproduces the issue.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas
import numpy as np
import datetime

# create large list of non periodic datetime
dates = []
sec = datetime.timedelta(seconds=1)
half_sec = sec / 2
d = datetime.datetime(2011, 12, 5, 20, 30)
n = 100000
for i in range(n):
    dates.append(d)
    dates.append(d + sec)
    dates.append(d + sec + half_sec)
    dates.append(d + sec + sec + half_sec)
    d += 3 * sec

# duplicate some values in the list
duplicate_positions = np.random.randint(0, len(dates) - 1, 20)
for p in duplicate_positions:
    dates[p + 1] = dates[p]
print &quot;duplicated values at %s&quot; % str(duplicate_positions)

df = pandas.DataFrame(np.random.randn(len(dates), 4),
                      index=dates,
                      columns=list('ABCD'))

pos = n * 3
timestamp = df.index[pos]
print &quot;timestamp = df.index[%d] = %s&quot; % (pos, str(timestamp))
print &quot;timestamp in index? %s&quot; % str(timestamp in df.index)
print &quot;df.ix[timestamp] = \n%s&quot; % str(df.ix[timestamp])
print &quot;df.ix[[timestamp]] = \n%s&quot; % str(df.ix[[timestamp]])"><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-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">datetime</span>

<span class="pl-c"># create large list of non periodic datetime</span>
<span class="pl-s1">dates</span> <span class="pl-c1">=</span> []
<span class="pl-s1">sec</span> <span class="pl-c1">=</span> <span class="pl-s1">datetime</span>.<span class="pl-en">timedelta</span>(<span class="pl-s1">seconds</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)
<span class="pl-s1">half_sec</span> <span class="pl-c1">=</span> <span class="pl-s1">sec</span> <span class="pl-c1">/</span> <span class="pl-c1">2</span>
<span class="pl-s1">d</span> <span class="pl-c1">=</span> <span class="pl-s1">datetime</span>.<span class="pl-en">datetime</span>(<span class="pl-c1">2011</span>, <span class="pl-c1">12</span>, <span class="pl-c1">5</span>, <span class="pl-c1">20</span>, <span class="pl-c1">30</span>)
<span class="pl-s1">n</span> <span class="pl-c1">=</span> <span class="pl-c1">100000</span>
<span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-s1">n</span>):
    <span class="pl-s1">dates</span>.<span class="pl-en">append</span>(<span class="pl-s1">d</span>)
    <span class="pl-s1">dates</span>.<span class="pl-en">append</span>(<span class="pl-s1">d</span> <span class="pl-c1">+</span> <span class="pl-s1">sec</span>)
    <span class="pl-s1">dates</span>.<span class="pl-en">append</span>(<span class="pl-s1">d</span> <span class="pl-c1">+</span> <span class="pl-s1">sec</span> <span class="pl-c1">+</span> <span class="pl-s1">half_sec</span>)
    <span class="pl-s1">dates</span>.<span class="pl-en">append</span>(<span class="pl-s1">d</span> <span class="pl-c1">+</span> <span class="pl-s1">sec</span> <span class="pl-c1">+</span> <span class="pl-s1">sec</span> <span class="pl-c1">+</span> <span class="pl-s1">half_sec</span>)
    <span class="pl-s1">d</span> <span class="pl-c1">+=</span> <span class="pl-c1">3</span> <span class="pl-c1">*</span> <span class="pl-s1">sec</span>

<span class="pl-c"># duplicate some values in the list</span>
<span class="pl-s1">duplicate_positions</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randint</span>(<span class="pl-c1">0</span>, <span class="pl-en">len</span>(<span class="pl-s1">dates</span>) <span class="pl-c1">-</span> <span class="pl-c1">1</span>, <span class="pl-c1">20</span>)
<span class="pl-k">for</span> <span class="pl-s1">p</span> <span class="pl-c1">in</span> <span class="pl-s1">duplicate_positions</span>:
    <span class="pl-s1">dates</span>[<span class="pl-s1">p</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span>] <span class="pl-c1">=</span> <span class="pl-s1">dates</span>[<span class="pl-s1">p</span>]
<span class="pl-k">print</span> <span class="pl-s">"duplicated values at %s"</span> <span class="pl-c1">%</span> <span class="pl-en">str</span>(<span class="pl-s1">duplicate_positions</span>)

<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-en">len</span>(<span class="pl-s1">dates</span>), <span class="pl-c1">4</span>),
                      <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">dates</span>,
                      <span class="pl-s1">columns</span><span class="pl-c1">=</span><span class="pl-en">list</span>(<span class="pl-s">'ABCD'</span>))

<span class="pl-s1">pos</span> <span class="pl-c1">=</span> <span class="pl-s1">n</span> <span class="pl-c1">*</span> <span class="pl-c1">3</span>
<span class="pl-s1">timestamp</span> <span class="pl-c1">=</span> <span class="pl-s1">df</span>.<span class="pl-s1">index</span>[<span class="pl-s1">pos</span>]
<span class="pl-k">print</span> <span class="pl-s">"timestamp = df.index[%d] = %s"</span> <span class="pl-c1">%</span> (<span class="pl-s1">pos</span>, <span class="pl-en">str</span>(<span class="pl-s1">timestamp</span>))
<span class="pl-k">print</span> <span class="pl-s">"timestamp in index? %s"</span> <span class="pl-c1">%</span> <span class="pl-en">str</span>(<span class="pl-s1">timestamp</span> <span class="pl-c1">in</span> <span class="pl-s1">df</span>.<span class="pl-s1">index</span>)
<span class="pl-k">print</span> <span class="pl-s">"df.ix[timestamp] = <span class="pl-cce">\n</span>%s"</span> <span class="pl-c1">%</span> <span class="pl-en">str</span>(<span class="pl-s1">df</span>.<span class="pl-s1">ix</span>[<span class="pl-s1">timestamp</span>])
<span class="pl-k">print</span> <span class="pl-s">"df.ix[[timestamp]] = <span class="pl-cce">\n</span>%s"</span> <span class="pl-c1">%</span> <span class="pl-en">str</span>(<span class="pl-s1">df</span>.<span class="pl-s1">ix</span>[[<span class="pl-s1">timestamp</span>]])</pre></div>
<p dir="auto">running this script outputs:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="duplicated values at [143779 365504 338898 192427  63827 333772 366805 378282 375136  77760
  59843 215934 173395 185449 310734 184004  48594 221298 348967  86615]
timestamp = df.index[300000] = 2011-12-08 11:00:00
timestamp in index? True
df.ix[timestamp] = 
A    0.959639
B    0.651874
C    1.059355
D   -1.296393
Name: 2011-12-08 11:00:00
df.ix[[timestamp]] = 
Empty DataFrame
Columns: array([A, B, C, D], dtype=object)
Index: &lt;class 'pandas.tseries.index.DatetimeIndex'&gt;
Length: 0, Freq: None, Timezone: None"><pre class="notranslate"><code class="notranslate">duplicated values at [143779 365504 338898 192427  63827 333772 366805 378282 375136  77760
  59843 215934 173395 185449 310734 184004  48594 221298 348967  86615]
timestamp = df.index[300000] = 2011-12-08 11:00:00
timestamp in index? True
df.ix[timestamp] = 
A    0.959639
B    0.651874
C    1.059355
D   -1.296393
Name: 2011-12-08 11:00:00
df.ix[[timestamp]] = 
Empty DataFrame
Columns: array([A, B, C, D], dtype=object)
Index: &lt;class 'pandas.tseries.index.DatetimeIndex'&gt;
Length: 0, Freq: None, Timezone: None
</code></pre></div>
<p dir="auto">for n = 1000000 it gets worse</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="duplicated values at [ 686452 3862593 3747433   63099 2422495 2191536  486238 1632442 2373460
 3266942 3127937 2538658 1405505  739509 1519644 2817907 1005119  755410
 1784244   86211]
timestamp = df.index[3000000] = 2011-12-31 21:30:00
timestamp in index? False
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
...
TypeError: Cannot compare Timestamp with 1326116999500000000"><pre class="notranslate"><span class="pl-s1">duplicated</span> <span class="pl-s1">values</span> <span class="pl-s1">at</span> [ <span class="pl-c1">686452</span> <span class="pl-c1">3862593</span> <span class="pl-c1">3747433</span>   <span class="pl-c1">63099</span> <span class="pl-c1">2422495</span> <span class="pl-c1">2191536</span>  <span class="pl-c1">486238</span> <span class="pl-c1">1632442</span> <span class="pl-c1">2373460</span>
 <span class="pl-c1">3266942</span> <span class="pl-c1">3127937</span> <span class="pl-c1">2538658</span> <span class="pl-c1">1405505</span>  <span class="pl-c1">739509</span> <span class="pl-c1">1519644</span> <span class="pl-c1">2817907</span> <span class="pl-c1">1005119</span>  <span class="pl-c1">755410</span>
 <span class="pl-c1">1784244</span>   <span class="pl-c1">86211</span>]
<span class="pl-s1">timestamp</span> <span class="pl-c1">=</span> <span class="pl-s1">df</span>.<span class="pl-s1">index</span>[<span class="pl-c1">3000000</span>] <span class="pl-c1">=</span> <span class="pl-c1">2011</span><span class="pl-c1">-</span><span class="pl-c1">12</span><span class="pl-c1">-</span><span class="pl-c1">31</span> <span class="pl-c1">21</span>:<span class="pl-c1">30</span>:<span class="pl-c1">00</span>
<span class="pl-s1">timestamp</span> <span class="pl-c1">in</span> <span class="pl-s1">index</span>? <span class="pl-c1">False</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>
<span class="pl-v">TypeError</span>                                 <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
...
<span class="pl-v">TypeError</span>: <span class="pl-v">Cannot</span> <span class="pl-s1">compare</span> <span class="pl-v">Timestamp</span> <span class="pl-s1">with</span> <span class="pl-c1">1326116999500000000</span></pre></div>