<p dir="auto">It's pretty unexpected that the behavior of <code class="notranslate">x &lt;= pd.Series(...)</code> depends on whether <code class="notranslate">x</code> is a python float or a <code class="notranslate">np.float64</code>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import pandas as pd
&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; 5 &lt;= pd.Series(range(10))
0    False
1    False
2    False
3    False
4    False
5     True
6     True
7     True
8     True
9     True
dtype: bool
&gt;&gt;&gt; np.float64(5) &lt;= pd.Series(range(10))
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/local/lib/python2.7/dist-packages/pandas/core/ops.py&quot;, line 588, in wrapper
    if len(self) != len(other):
TypeError: len() of unsized object
&gt;&gt;&gt; pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.3.final.0
python-bits: 64
OS: Linux
OS-release: 3.2.0-54-virtual
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.16.2
nose: 1.3.3
Cython: None
numpy: 1.9.2
scipy: 0.14.0
statsmodels: 0.5.0
IPython: 0.12.1
sphinx: None
patsy: 0.3.0
dateutil: 2.2
pytz: 2014.4
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.3.1
openpyxl: 1.8.6
xlrd: 0.9.3
xlwt: None
xlsxwriter: None
lxml: 3.3.2
bs4: None
html5lib: None
httplib2: 0.7.2
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: 2.5.2 (dt dec pq3 ext)
&gt;&gt;&gt;"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <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-c1">&gt;&gt;</span><span class="pl-c1">&gt;</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-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-c1">5</span> <span class="pl-c1">&lt;=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>(<span class="pl-en">range</span>(<span class="pl-c1">10</span>))
<span class="pl-c1">0</span>    <span class="pl-c1">False</span>
<span class="pl-c1">1</span>    <span class="pl-c1">False</span>
<span class="pl-c1">2</span>    <span class="pl-c1">False</span>
<span class="pl-c1">3</span>    <span class="pl-c1">False</span>
<span class="pl-c1">4</span>    <span class="pl-c1">False</span>
<span class="pl-c1">5</span>     <span class="pl-c1">True</span>
<span class="pl-c1">6</span>     <span class="pl-c1">True</span>
<span class="pl-c1">7</span>     <span class="pl-c1">True</span>
<span class="pl-c1">8</span>     <span class="pl-c1">True</span>
<span class="pl-c1">9</span>     <span class="pl-c1">True</span>
<span class="pl-s1">dtype</span>: <span class="pl-s1">bool</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-en">float64</span>(<span class="pl-c1">5</span>) <span class="pl-c1">&lt;=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>(<span class="pl-en">range</span>(<span class="pl-c1">10</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">File</span> <span class="pl-s">"&lt;stdin&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python2.7/dist-packages/pandas/core/ops.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">588</span>, <span class="pl-s1">in</span> <span class="pl-s1">wrapper</span>
    <span class="pl-k">if</span> <span class="pl-en">len</span>(<span class="pl-s1">self</span>) <span class="pl-c1">!=</span> <span class="pl-en">len</span>(<span class="pl-s1">other</span>):
<span class="pl-v">TypeError</span>: <span class="pl-en">len</span>() <span class="pl-s1">of</span> <span class="pl-s1">unsized</span> <span class="pl-s1">object</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">pd</span>.<span class="pl-en">show_versions</span>()

<span class="pl-v">INSTALLED</span> <span class="pl-v">VERSIONS</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-s1">commit</span>: <span class="pl-c1">None</span>
<span class="pl-s1">python</span>: <span class="pl-c1">2.7</span>.<span class="pl-c1">3.</span><span class="pl-s1">final</span>.<span class="pl-c1">0</span>
<span class="pl-s1">python</span><span class="pl-c1">-</span><span class="pl-s1">bits</span>: <span class="pl-c1">64</span>
<span class="pl-v">OS</span>: <span class="pl-v">Linux</span>
<span class="pl-v">OS</span><span class="pl-c1">-</span><span class="pl-s1">release</span>: <span class="pl-c1">3.2</span><span class="pl-c1">.0</span><span class="pl-c1">-</span><span class="pl-c1">54</span><span class="pl-c1">-</span><span class="pl-s1">virtual</span>
<span class="pl-s1">machine</span>: <span class="pl-s1">x86_64</span>
<span class="pl-s1">processor</span>: <span class="pl-s1">x86_64</span>
<span class="pl-s1">byteorder</span>: <span class="pl-s1">little</span>
<span class="pl-v">LC_ALL</span>: <span class="pl-c1">None</span>
<span class="pl-v">LANG</span>: <span class="pl-s1">en_US</span>.<span class="pl-v">UTF</span><span class="pl-c1">-</span><span class="pl-c1">8</span>

<span class="pl-s1">pandas</span>: <span class="pl-c1">0.16</span>.<span class="pl-c1">2</span>
<span class="pl-s1">nose</span>: <span class="pl-c1">1.3</span>.<span class="pl-c1">3</span>
<span class="pl-v">Cython</span>: <span class="pl-c1">None</span>
<span class="pl-s1">numpy</span>: <span class="pl-c1">1.9</span>.<span class="pl-c1">2</span>
<span class="pl-s1">scipy</span>: <span class="pl-c1">0.14</span>.<span class="pl-c1">0</span>
<span class="pl-s1">statsmodels</span>: <span class="pl-c1">0.5</span>.<span class="pl-c1">0</span>
<span class="pl-v">IPython</span>: <span class="pl-c1">0.12</span>.<span class="pl-c1">1</span>
<span class="pl-s1">sphinx</span>: <span class="pl-c1">None</span>
<span class="pl-s1">patsy</span>: <span class="pl-c1">0.3</span>.<span class="pl-c1">0</span>
<span class="pl-s1">dateutil</span>: <span class="pl-c1">2.2</span>
<span class="pl-s1">pytz</span>: <span class="pl-c1">2014.4</span>
<span class="pl-s1">bottleneck</span>: <span class="pl-c1">None</span>
<span class="pl-s1">tables</span>: <span class="pl-c1">None</span>
<span class="pl-s1">numexpr</span>: <span class="pl-c1">None</span>
<span class="pl-s1">matplotlib</span>: <span class="pl-c1">1.3</span>.<span class="pl-c1">1</span>
<span class="pl-s1">openpyxl</span>: <span class="pl-c1">1.8</span>.<span class="pl-c1">6</span>
<span class="pl-s1">xlrd</span>: <span class="pl-c1">0.9</span>.<span class="pl-c1">3</span>
<span class="pl-s1">xlwt</span>: <span class="pl-c1">None</span>
<span class="pl-s1">xlsxwriter</span>: <span class="pl-c1">None</span>
<span class="pl-s1">lxml</span>: <span class="pl-c1">3.3</span>.<span class="pl-c1">2</span>
<span class="pl-s1">bs4</span>: <span class="pl-c1">None</span>
<span class="pl-s1">html5lib</span>: <span class="pl-c1">None</span>
<span class="pl-s1">httplib2</span>: <span class="pl-c1">0.7</span>.<span class="pl-c1">2</span>
<span class="pl-s1">apiclient</span>: <span class="pl-c1">None</span>
<span class="pl-s1">sqlalchemy</span>: <span class="pl-c1">None</span>
<span class="pl-s1">pymysql</span>: <span class="pl-c1">None</span>
<span class="pl-s1">psycopg2</span>: <span class="pl-c1">2.5</span>.<span class="pl-c1">2</span> (<span class="pl-s1">dt</span> <span class="pl-s1">dec</span> <span class="pl-s1">pq3</span> <span class="pl-s1">ext</span>)
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">I have the following .csv file:</p>
<table role="table">
<thead>
<tr>
<th>A</th>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>one</td>
<td>one</td>
<td>two</td>
</tr>
<tr>
<td>0</td>
<td>34</td>
<td>0.1</td>
</tr>
</tbody>
</table>
<p dir="auto">I want to use the first two rows to create MultiIndex columns. However, the first and second columns are duplicated and pandas is handling that in a weird way.</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="print(pd.read_csv('test.csv',header=[0,1]).columns)
&gt;&gt; Index([('A', 'one'), '('A', 'one').1', ('B', 'two')], dtype='object')"><pre class="notranslate"><span class="pl-en">print</span>(<span class="pl-s1">pd</span>.<span class="pl-en">read_csv</span>(<span class="pl-s">'test.csv'</span>,<span class="pl-s1">header</span><span class="pl-c1">=</span>[<span class="pl-c1">0</span>,<span class="pl-c1">1</span>]).<span class="pl-s1">columns</span>)
<span class="pl-c1">&gt;&gt;</span> <span class="pl-v">Index</span>([(<span class="pl-s">'A'</span>, <span class="pl-s">'one'</span>), <span class="pl-s">'('</span><span class="pl-v">A</span><span class="pl-s">', '</span><span class="pl-s1">one</span><span class="pl-s">').1'</span>, (<span class="pl-s">'B'</span>, <span class="pl-s">'two'</span>)], <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s">'object'</span>)</pre></div>
<p dir="auto">This output is a total mess, the first column and last are tuples while the second column is a string. Also, this is not a MultiIndex, it's an Index. Raising an error or having the option to delete the duplicate columns would be a better solution.</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.5.2.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 4.4.0-97-generic<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: en_GB.UTF-8<br>
LOCALE: en_GB.UTF-8</p>
<p dir="auto">pandas: 0.21.0<br>
pytest: 2.9.2<br>
pip: 9.0.1<br>
setuptools: 27.2.0<br>
Cython: 0.24.1<br>
numpy: 1.13.3<br>
scipy: 0.18.1<br>
pyarrow: None<br>
xarray: None<br>
IPython: 5.1.0<br>
sphinx: 1.4.6<br>
patsy: 0.4.1<br>
dateutil: 2.6.1<br>
pytz: 2017.3<br>
blosc: None<br>
bottleneck: 1.1.0<br>
tables: 3.2.3.1<br>
numexpr: 2.6.1<br>
feather: None<br>
matplotlib: 1.5.3<br>
openpyxl: 2.3.2<br>
xlrd: 1.0.0<br>
xlwt: 1.1.2<br>
xlsxwriter: 0.9.3<br>
lxml: 3.6.4<br>
bs4: 4.5.1<br>
html5lib: None<br>
sqlalchemy: 1.0.13<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.8<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>