<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd
df = pd.read_csv(file)
df.index = pd.to_datetime(df[['Year','Month','Day','Hour']], unit='s')
df[df.index.duplicated()].index"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">read_csv</span>(<span class="pl-s1">file</span>)
<span class="pl-s1">df</span>.<span class="pl-s1">index</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">to_datetime</span>(<span class="pl-s1">df</span>[[<span class="pl-s">'Year'</span>,<span class="pl-s">'Month'</span>,<span class="pl-s">'Day'</span>,<span class="pl-s">'Hour'</span>]], <span class="pl-s1">unit</span><span class="pl-c1">=</span><span class="pl-s">'s'</span>)
<span class="pl-s1">df</span>[<span class="pl-s1">df</span>.<span class="pl-s1">index</span>.<span class="pl-en">duplicated</span>()].<span class="pl-s1">index</span></pre></div>
<blockquote>
<p dir="auto">DatetimeIndex(['2009-01-01 00:00:00', '2009-01-01 00:30:00',<br>
'2009-01-01 01:00:00', '2009-01-01 01:30:00',<br>
'2009-01-01 02:00:00', '2009-01-01 02:30:00',<br>
'2009-01-01 03:00:00', '2009-01-01 03:30:00',<br>
'2009-01-01 04:00:00', '2009-01-01 04:30:00',<br>
...<br>
'2013-12-31 19:00:00', '2013-12-31 19:30:00',<br>
'2013-12-31 20:00:00', '2013-12-31 20:30:00',<br>
'2013-12-31 21:00:00', '2013-12-31 21:30:00',<br>
'2013-12-31 22:00:00', '2013-12-31 22:30:00',<br>
'2013-12-31 23:00:00', '2013-12-31 23:30:00'],<br>
dtype='datetime64[ns]', length=175296, freq=None)</p>
</blockquote>
<h4 dir="auto">Problem description</h4>
<p dir="auto">The behaviour of <code class="notranslate">duplicated()</code> is returning duplicated days when the <code class="notranslate">datetime</code> values are in fact unique at their native temporal resolution. I would expect this function to return true duplicates.</p>
<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd, numpy as np

idx = pd.MultiIndex.from_tuples([(0, 0), (1, 1), (1, 1), (2, 2)])
a = pd.Series(np.arange(4), index=idx)
new_idx = pd.MultiIndex.from_tuples([(0, 0), (1, 1), (2, 2)])
a.reindex(new_idx)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>, <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">idx</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">MultiIndex</span>.<span class="pl-en">from_tuples</span>([(<span class="pl-c1">0</span>, <span class="pl-c1">0</span>), (<span class="pl-c1">1</span>, <span class="pl-c1">1</span>), (<span class="pl-c1">1</span>, <span class="pl-c1">1</span>), (<span class="pl-c1">2</span>, <span class="pl-c1">2</span>)])
<span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>(<span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">4</span>), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">idx</span>)
<span class="pl-s1">new_idx</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">MultiIndex</span>.<span class="pl-en">from_tuples</span>([(<span class="pl-c1">0</span>, <span class="pl-c1">0</span>), (<span class="pl-c1">1</span>, <span class="pl-c1">1</span>), (<span class="pl-c1">2</span>, <span class="pl-c1">2</span>)])
<span class="pl-s1">a</span>.<span class="pl-en">reindex</span>(<span class="pl-s1">new_idx</span>)</pre></div>
<div class="highlight highlight-text-python-traceback notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="(...)  
 2094                 else:
-&gt; 2095                     raise Exception(&quot;cannot handle a non-unique multi-index!&quot;)
   2096 
   2097         if not isinstance(target, MultiIndex):

Exception: cannot handle a non-unique multi-index!"><pre class="notranslate">(...)  
 2094                 else:
-&gt; 2095                     raise Exception("cannot handle a non-unique multi-index!")
   2096 
   2097         if not isinstance(target, MultiIndex):

<span class="pl-en">Exception</span>: <span class="pl-s">cannot handle a non-unique multi-index!</span></pre></div>
<h4 dir="auto">Problem description</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class MultiIndex(Index):
    (...)
    def reindex(self, target, method=None, level=None, limit=None,
        tolerance=None):
        (...)
                else:
                    raise Exception(&quot;cannot handle a non-unique multi-index!&quot;)"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">MultiIndex</span>(<span class="pl-v">Index</span>):
    (...)
    <span class="pl-k">def</span> <span class="pl-en">reindex</span>(<span class="pl-s1">self</span>, <span class="pl-s1">target</span>, <span class="pl-s1">method</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-s1">level</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-s1">limit</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,
        <span class="pl-s1">tolerance</span><span class="pl-c1">=</span><span class="pl-c1">None</span>):
        (...)
                <span class="pl-s1">else</span>:
                    <span class="pl-s1">raise</span> <span class="pl-v">Exception</span>(<span class="pl-s">"cannot handle a non-unique multi-index!"</span>)</pre></div>
<p dir="auto">In <a href="https://github.com/pandas-dev/pandas/blob/master/pandas/core/indexes/multi.py#L2026"><code class="notranslate">MultiIndex.reindex</code></a>, this exception is too generic, and thus not easily filtered. I think it should be an <code class="notranslate">IndexError</code></p>
<h4 dir="auto">Expected Output</h4>
<p dir="auto"><code class="notranslate">raise IndexError("cannot handle a non-unique multi-index!")</code></p>
<p dir="auto">I can do a very minimal PR to fix this if needed.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.6.5.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 4.15.0-24-generic<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: fr_FR.UTF-8<br>
LOCALE: fr_FR.UTF-8</p>
<p dir="auto">pandas: 0.23.1<br>
pytest: 3.6.2<br>
pip: 10.0.1<br>
setuptools: 39.2.0<br>
Cython: 0.28.3<br>
numpy: 1.14.5<br>
scipy: 1.1.0<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.4.0<br>
sphinx: None<br>
patsy: 0.5.0<br>
dateutil: 2.7.3<br>
pytz: 2018.5<br>
blosc: None<br>
bottleneck: None<br>
tables: 3.4.4<br>
numexpr: 2.6.5<br>
feather: None<br>
matplotlib: 2.2.2<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: 1.0.1<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.10<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>