<p dir="auto">The following throws a very confusing error (pandas 0.13.1):</p>
<p dir="auto">pd.DataFrame([[1,"abc", 1]], columns=["a", "b", "a"]).describe()</p>
<p dir="auto">File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\frame.py", line 3790, in describe<br>
numdata = self._get_numeric_data()<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\generic.py", line 1894, in _get_numeric_data<br>
self._data.get_numeric_data()).<strong>finalize</strong>(self)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\internals.py", line 2596, in get_numeric_data<br>
return self.get_data(**kwargs)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\internals.py", line 2610, in get_data<br>
return self.combine(blocks)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\internals.py", line 2624, in combine<br>
return self.<strong>class</strong>(new_blocks, new_axes, do_integrity_check=False)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\internals.py", line 2037, in <strong>init</strong><br>
self._set_ref_locs(do_refs=True)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\internals.py", line 2189, in _set_ref_locs<br>
rl[loc] = (block, i)<br>
IndexError: list assignment index out of range</p>
<p dir="auto">pd.DataFrame([[1,"abc", 1]], columns=["a", "b", "a"]).info()<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\frame.py", line 1443, in info<br>
counts = self.count()<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\frame.py", line 3862, in count<br>
result = notnull(frame).sum(axis=axis)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\common.py", line 273, in notnull<br>
res = isnull(obj)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\common.py", line 125, in isnull<br>
return _isnull(obj)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\common.py", line 137, in _isnull_new<br>
return obj._constructor(obj._data.apply(lambda x: isnull(x.values)))<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\internals.py", line 2384, in apply<br>
do_integrity_check=do_integrity_check)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\internals.py", line 2037, in <strong>init</strong><br>
self._set_ref_locs(do_refs=True)<br>
File "C:\Program Files\Python 3.3.3\lib\site-packages\pandas\core\internals.py", line 2177, in _set_ref_locs<br>
'have _ref_locs set' % (block, labels))<br>
AssertionError: Cannot create BlockManager._ref_locs because block [BoolBlock: [a, a], 2 x 1, dtype: bool] with duplicate items [Index(['a', 'b', 'a'], dtype='object')] does not have _ref_locs set</p>
<p dir="auto">Note that there are multiple ways to avoid the error:</p>
<ul dir="auto">
<li>not having duplicate column names</li>
<li>changing the type of column "b" or deleting it!</li>
</ul>
<p dir="auto">In my program I had duplicate names only accidently, but still this behaviour and dependence on the non-duplicate column looks like a bug to me.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [88]: idx = pd.Index([1, 2, 3])

In [89]: idx.summary()
Out[89]: 'Int64Index: 3 entries, 1 to 3'"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">88</span>]: <span class="pl-s1">idx</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Index</span>([<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>])

<span class="pl-v">In</span> [<span class="pl-c1">89</span>]: <span class="pl-s1">idx</span>.<span class="pl-en">summary</span>()
<span class="pl-v">Out</span>[<span class="pl-c1">89</span>]: <span class="pl-s">'Int64Index: 3 entries, 1 to 3'</span></pre></div>