<p dir="auto">With the following, I can plot work, but I can not plot nowork. I can't see any clear difference between the two resulting dataframes. I also get the issue when trying to slice use .loc and range of labels.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="work = mp_stats_unstack.xs(0, level='CPU', axis=1).iloc[:,[x for x in range(48,63)]]
nowork = mp_stats_unstack.xs(0, level='CPU', axis=1).iloc[:,48:63]
nowork
&lt;class 'pandas.core.frame.DataFrame'&gt;
Int64Index: 1848 entries, 1378842548 to 1378844396
Data columns (total 15 columns):
NMI/s    1848  non-null values
LOC/s    1848  non-null values
SPU/s    1848  non-null values
PMI/s    1848  non-null values
IWI/s    1848  non-null values
RTR/s    1848  non-null values
RES/s    1848  non-null values
CAL/s    1848  non-null values
TLB/s    1848  non-null values
TRM/s    1848  non-null values
THR/s    1848  non-null values
MCE/s    1848  non-null values
MCP/s    1848  non-null values
ERR/s    1848  non-null values
MIS/s    1848  non-null values
dtypes: float64(15)

work
&lt;class 'pandas.core.frame.DataFrame'&gt;
Int64Index: 1848 entries, 1378842548 to 1378844396
Data columns (total 15 columns):
NMI/s    1848  non-null values
LOC/s    1848  non-null values
SPU/s    1848  non-null values
PMI/s    1848  non-null values
IWI/s    1848  non-null values
RTR/s    1848  non-null values
RES/s    1848  non-null values
CAL/s    1848  non-null values
TLB/s    1848  non-null values
TRM/s    1848  non-null values
THR/s    1848  non-null values
MCE/s    1848  non-null values
MCP/s    1848  non-null values
ERR/s    1848  non-null values
MIS/s    1848  non-null values
dtypes: float64(15)

nowork.plot()
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
&lt;ipython-input-482-b831b20208bb&gt; in &lt;module&gt;()
----&gt; 1 nowork.plot()

/usr/local/lib/python3.3/site-packages/pandas/tools/plotting.py in plot_frame(frame, x, y, subplots, sharex, sharey, use_index, figsize, grid, legend, rot, ax, style, title, xlim, ylim, logx, logy, xticks, yticks, kind, sort_columns, fontsize, secondary_y, **kwds)
   1634                      logy=logy, sort_columns=sort_columns,
   1635                      secondary_y=secondary_y, **kwds)
-&gt; 1636     plot_obj.generate()
   1637     plot_obj.draw()
   1638     if subplots:

/usr/local/lib/python3.3/site-packages/pandas/tools/plotting.py in generate(self)
    852     def generate(self):
    853         self._args_adjust()
--&gt; 854         self._compute_plot_data()
    855         self._setup_subplots()
    856         self._make_plot()

/usr/local/lib/python3.3/site-packages/pandas/tools/plotting.py in _compute_plot_data(self)
    925         try:
    926             # might be an ndframe
--&gt; 927             numeric_data = self.data._get_numeric_data()
    928         except AttributeError:  # TODO: rm in 0.13 (series-inherit-ndframe)
    929             numeric_data = self.data

/usr/local/lib/python3.3/site-packages/pandas/core/frame.py in _get_numeric_data(self)
   5291 
   5292     def _get_numeric_data(self):
-&gt; 5293         return self._constructor(self._data.get_numeric_data(), index=self.index, copy=False)
   5294 
   5295     def _get_bool_data(self):

/usr/local/lib/python3.3/site-packages/pandas/core/internals.py in get_numeric_data(self, copy, type_list, as_blocks)
   1398 
   1399         indexer = np.sort(np.concatenate([b.ref_locs for b in num_blocks]))
-&gt; 1400         new_items = self.items.take(indexer)
   1401 
   1402         new_blocks = []

/usr/local/lib/python3.3/site-packages/pandas/core/index.py in take(self, indexer, axis)
    393         &quot;&quot;&quot;
    394         indexer = com._ensure_platform_int(indexer)
--&gt; 395         taken = self.view(np.ndarray).take(indexer)
    396         return self._constructor(taken, name=self.name)
    397 

IndexError: index 15 is out of bounds for axis 0 with size 15"><pre class="notranslate"><span class="pl-s1">work</span> <span class="pl-c1">=</span> <span class="pl-s1">mp_stats_unstack</span>.<span class="pl-en">xs</span>(<span class="pl-c1">0</span>, <span class="pl-s1">level</span><span class="pl-c1">=</span><span class="pl-s">'CPU'</span>, <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>).<span class="pl-s1">iloc</span>[:,[<span class="pl-s1">x</span> <span class="pl-k">for</span> <span class="pl-s1">x</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-c1">48</span>,<span class="pl-c1">63</span>)]]
<span class="pl-s1">nowork</span> <span class="pl-c1">=</span> <span class="pl-s1">mp_stats_unstack</span>.<span class="pl-en">xs</span>(<span class="pl-c1">0</span>, <span class="pl-s1">level</span><span class="pl-c1">=</span><span class="pl-s">'CPU'</span>, <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>).<span class="pl-s1">iloc</span>[:,<span class="pl-c1">48</span>:<span class="pl-c1">63</span>]
<span class="pl-s1">nowork</span>
<span class="pl-c1">&lt;</span><span class="pl-k">class</span> <span class="pl-s">'pandas.core.frame.DataFrame'</span><span class="pl-c1">&gt;</span>
<span class="pl-v">Int64Index</span>: <span class="pl-c1">1848</span> <span class="pl-s1">entries</span>, <span class="pl-c1">1378842548</span> <span class="pl-s1">to</span> <span class="pl-c1">1378844396</span>
<span class="pl-v">Data</span> <span class="pl-en">columns</span> (<span class="pl-s1">total</span> <span class="pl-c1">15</span> <span class="pl-s1">columns</span>):
<span class="pl-v">NMI</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">LOC</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">SPU</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">PMI</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">IWI</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">RTR</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">RES</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">CAL</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">TLB</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">TRM</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">THR</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">MCE</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">MCP</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">ERR</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">MIS</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-s1">dtypes</span>: <span class="pl-en">float64</span>(<span class="pl-c1">15</span>)

<span class="pl-s1">work</span>
<span class="pl-c1">&lt;</span><span class="pl-k">class</span> <span class="pl-s">'pandas.core.frame.DataFrame'</span><span class="pl-c1">&gt;</span>
<span class="pl-v">Int64Index</span>: <span class="pl-c1">1848</span> <span class="pl-s1">entries</span>, <span class="pl-c1">1378842548</span> <span class="pl-s1">to</span> <span class="pl-c1">1378844396</span>
<span class="pl-v">Data</span> <span class="pl-en">columns</span> (<span class="pl-s1">total</span> <span class="pl-c1">15</span> <span class="pl-s1">columns</span>):
<span class="pl-v">NMI</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">LOC</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">SPU</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">PMI</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">IWI</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">RTR</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">RES</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">CAL</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">TLB</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">TRM</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">THR</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">MCE</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">MCP</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">ERR</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-v">MIS</span><span class="pl-c1">/</span><span class="pl-s1">s</span>    <span class="pl-c1">1848</span>  <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">null</span> <span class="pl-s1">values</span>
<span class="pl-s1">dtypes</span>: <span class="pl-en">float64</span>(<span class="pl-c1">15</span>)

<span class="pl-s1">nowork</span>.<span class="pl-en">plot</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">IndexError</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-c1">&lt;</span><span class="pl-s1">ipython</span><span class="pl-c1">-</span><span class="pl-s1">input</span><span class="pl-c1">-</span><span class="pl-c1">482</span><span class="pl-c1">-</span><span class="pl-s1">b831b20208bb</span><span class="pl-c1">&gt;</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-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1</span> <span class="pl-s1">nowork</span>.<span class="pl-en">plot</span>()

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">3</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">tools</span><span class="pl-c1">/</span><span class="pl-s1">plotting</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">plot_frame</span>(<span class="pl-s1">frame</span>, <span class="pl-s1">x</span>, <span class="pl-s1">y</span>, <span class="pl-s1">subplots</span>, <span class="pl-s1">sharex</span>, <span class="pl-s1">sharey</span>, <span class="pl-s1">use_index</span>, <span class="pl-s1">figsize</span>, <span class="pl-s1">grid</span>, <span class="pl-s1">legend</span>, <span class="pl-s1">rot</span>, <span class="pl-s1">ax</span>, <span class="pl-s1">style</span>, <span class="pl-s1">title</span>, <span class="pl-s1">xlim</span>, <span class="pl-s1">ylim</span>, <span class="pl-s1">logx</span>, <span class="pl-s1">logy</span>, <span class="pl-s1">xticks</span>, <span class="pl-s1">yticks</span>, <span class="pl-s1">kind</span>, <span class="pl-s1">sort_columns</span>, <span class="pl-s1">fontsize</span>, <span class="pl-s1">secondary_y</span>, <span class="pl-c1">**</span><span class="pl-s1">kwds</span>)
   <span class="pl-c1">1634</span>                      <span class="pl-s1">logy</span><span class="pl-c1">=</span><span class="pl-s1">logy</span>, <span class="pl-s1">sort_columns</span><span class="pl-c1">=</span><span class="pl-s1">sort_columns</span>,
   <span class="pl-c1">1635</span>                      <span class="pl-s1">secondary_y</span><span class="pl-c1">=</span><span class="pl-s1">secondary_y</span>, <span class="pl-c1">**</span><span class="pl-s1">kwds</span>)
<span class="pl-c1">-&gt;</span> <span class="pl-c1">1636</span>     <span class="pl-s1">plot_obj</span>.<span class="pl-en">generate</span>()
   <span class="pl-c1">1637</span>     <span class="pl-s1">plot_obj</span>.<span class="pl-en">draw</span>()
   <span class="pl-c1">1638</span>     <span class="pl-k">if</span> <span class="pl-s1">subplots</span>:

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">3</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">tools</span><span class="pl-c1">/</span><span class="pl-s1">plotting</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">generate</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">852</span>     <span class="pl-s1">def</span> <span class="pl-en">generate</span>(<span class="pl-s1">self</span>):
    <span class="pl-c1">853</span>         <span class="pl-s1">self</span>.<span class="pl-en">_args_adjust</span>()
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">854</span>         <span class="pl-s1">self</span>.<span class="pl-en">_compute_plot_data</span>()
    <span class="pl-c1">855</span>         <span class="pl-s1">self</span>.<span class="pl-en">_setup_subplots</span>()
    <span class="pl-c1">856</span>         <span class="pl-s1">self</span>.<span class="pl-en">_make_plot</span>()

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">3</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">tools</span><span class="pl-c1">/</span><span class="pl-s1">plotting</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_compute_plot_data</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">925</span>         <span class="pl-k">try</span>:
    <span class="pl-c1">926</span>             <span class="pl-c"># might be an ndframe</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">927</span>             <span class="pl-s1">numeric_data</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">data</span>.<span class="pl-en">_get_numeric_data</span>()
    <span class="pl-c1">928</span>         <span class="pl-k">except</span> <span class="pl-v">AttributeError</span>:  <span class="pl-c"># TODO: rm in 0.13 (series-inherit-ndframe)</span>
    <span class="pl-c1">929</span>             <span class="pl-s1">numeric_data</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">data</span>

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">3</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">frame</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_get_numeric_data</span>(<span class="pl-s1">self</span>)
   <span class="pl-c1">5291</span> 
   <span class="pl-c1">5292</span>     <span class="pl-k">def</span> <span class="pl-en">_get_numeric_data</span>(<span class="pl-s1">self</span>):
<span class="pl-c1">-&gt;</span> <span class="pl-c1">5293</span>         <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_constructor</span>(<span class="pl-s1">self</span>.<span class="pl-s1">_data</span>.<span class="pl-en">get_numeric_data</span>(), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">index</span>, <span class="pl-s1">copy</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)
   <span class="pl-c1">5294</span> 
   <span class="pl-c1">5295</span>     <span class="pl-k">def</span> <span class="pl-en">_get_bool_data</span>(<span class="pl-s1">self</span>):

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">3</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">internals</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">get_numeric_data</span>(<span class="pl-s1">self</span>, <span class="pl-s1">copy</span>, <span class="pl-s1">type_list</span>, <span class="pl-s1">as_blocks</span>)
   <span class="pl-c1">1398</span> 
   <span class="pl-c1">1399</span>         <span class="pl-s1">indexer</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">sort</span>(<span class="pl-s1">np</span>.<span class="pl-en">concatenate</span>([<span class="pl-s1">b</span>.<span class="pl-s1">ref_locs</span> <span class="pl-k">for</span> <span class="pl-s1">b</span> <span class="pl-c1">in</span> <span class="pl-s1">num_blocks</span>]))
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1400</span>         <span class="pl-s1">new_items</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">items</span>.<span class="pl-en">take</span>(<span class="pl-s1">indexer</span>)
   <span class="pl-c1">1401</span> 
   <span class="pl-c1">1402</span>         <span class="pl-s1">new_blocks</span> <span class="pl-c1">=</span> []

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">3</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">index</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">take</span>(<span class="pl-s1">self</span>, <span class="pl-s1">indexer</span>, <span class="pl-s1">axis</span>)
    <span class="pl-c1">393</span>         """
    <span class="pl-c1">394</span>         <span class="pl-s1">indexer</span> <span class="pl-c1">=</span> <span class="pl-s1">com</span>.<span class="pl-en">_ensure_platform_int</span>(<span class="pl-s1">indexer</span>)
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">395</span>         <span class="pl-s1">taken</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">view</span>(<span class="pl-s1">np</span>.<span class="pl-s1">ndarray</span>).<span class="pl-en">take</span>(<span class="pl-s1">indexer</span>)
    <span class="pl-c1">396</span>         <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_constructor</span>(<span class="pl-s1">taken</span>, <span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">name</span>)
    <span class="pl-c1">397</span> 

<span class="pl-v">IndexError</span>: <span class="pl-s1">index</span> <span class="pl-c1">15</span> <span class="pl-c1">is</span> <span class="pl-s1">out</span> <span class="pl-s1">of</span> <span class="pl-s1">bounds</span> <span class="pl-s1">for</span> <span class="pl-s1">axis</span> <span class="pl-c1">0</span> <span class="pl-k">with</span> <span class="pl-s1">size</span> <span class="pl-c1">15</span></pre></div>
<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="In [2]: import pandas as pd

In [3]: pd.__version__
Out[3]: '0.23.0rc2'

In [4]: x = pd.DataFrame({'b': [1,2,3]}, index=[1,1,2])

In [5]: x
Out[5]: 
   b
1  1
1  2
2  3

In [6]: x.first_valid_index()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-6-baa2c482d9a6&gt; in &lt;module&gt;()
----&gt; 1 x.first_valid_index()

lib/python3.5/site-packages/pandas/core/generic.py in first_valid_index(self)
   8881                                              'klass': 'NDFrame'})
   8882     def first_valid_index(self):
-&gt; 8883         return self._find_valid_index('first')
   8884 
   8885     @Appender(_shared_docs['valid_index'] % {'position': 'last',

lib/python3.5/site-packages/pandas/core/generic.py in _find_valid_index(self, how)
   8867             # First valid value case
   8868             i = is_valid.idxmax()
-&gt; 8869             if not is_valid[i]:
   8870                 return None
   8871             return i

lib/python3.5/site-packages/pandas/core/generic.py in __nonzero__(self)
   1572         raise ValueError(&quot;The truth value of a {0} is ambiguous. &quot;
   1573                          &quot;Use a.empty, a.bool(), a.item(), a.any() or a.all().&quot;
-&gt; 1574                          .format(self.__class__.__name__))
   1575 
   1576     __bool__ = __nonzero__

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()."><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">2</span>]: <span class="pl-s1">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>

<span class="pl-v">In</span> [<span class="pl-c1">3</span>]: <span class="pl-s1">pd</span>.<span class="pl-s1">__version__</span>
<span class="pl-v">Out</span>[<span class="pl-c1">3</span>]: <span class="pl-s">'0.23.0rc2'</span>

<span class="pl-v">In</span> [<span class="pl-c1">4</span>]: <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">'b'</span>: [<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>]}, <span class="pl-s1">index</span><span class="pl-c1">=</span>[<span class="pl-c1">1</span>,<span class="pl-c1">1</span>,<span class="pl-c1">2</span>])

<span class="pl-v">In</span> [<span class="pl-c1">5</span>]: <span class="pl-s1">x</span>
<span class="pl-v">Out</span>[<span class="pl-c1">5</span>]: 
   <span class="pl-s1">b</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-c1">3</span>

<span class="pl-v">In</span> [<span class="pl-c1">6</span>]: <span class="pl-s1">x</span>.<span class="pl-en">first_valid_index</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">ValueError</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-c1">&lt;</span><span class="pl-s1">ipython</span><span class="pl-c1">-</span><span class="pl-s1">input</span><span class="pl-c1">-</span><span class="pl-c1">6</span><span class="pl-c1">-</span><span class="pl-s1">baa2c482d9a6</span><span class="pl-c1">&gt;</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-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1</span> <span class="pl-s1">x</span>.<span class="pl-en">first_valid_index</span>()

<span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">5</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">generic</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">first_valid_index</span>(<span class="pl-s1">self</span>)
   <span class="pl-c1">8881</span>                                              <span class="pl-s">'klass'</span>: <span class="pl-s">'NDFrame'</span>})
   <span class="pl-c1">8882</span>     <span class="pl-s1">def</span> <span class="pl-en">first_valid_index</span>(<span class="pl-s1">self</span>):
<span class="pl-c1">-&gt;</span> <span class="pl-c1">8883</span>         <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_find_valid_index</span>(<span class="pl-s">'first'</span>)
   <span class="pl-c1">8884</span> 
   <span class="pl-c1">8885</span>     @<span class="pl-v">Appender</span>(<span class="pl-s1">_shared_docs</span>[<span class="pl-s">'valid_index'</span>] <span class="pl-c1">%</span> {<span class="pl-s">'position'</span>: <span class="pl-s">'last'</span>,

<span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">5</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">generic</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">_find_valid_index</span>(<span class="pl-s1">self</span>, <span class="pl-s1">how</span>)
   <span class="pl-c1">8867</span>             <span class="pl-c"># First valid value case</span>
   <span class="pl-c1">8868</span>             <span class="pl-s1">i</span> <span class="pl-c1">=</span> <span class="pl-s1">is_valid</span>.<span class="pl-en">idxmax</span>()
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">8869</span>             <span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-s1">is_valid</span>[<span class="pl-s1">i</span>]:
   <span class="pl-c1">8870</span>                 <span class="pl-s1">return</span> <span class="pl-c1">None</span>
   <span class="pl-c1">8871</span>             <span class="pl-k">return</span> <span class="pl-s1">i</span>

<span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">5</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">generic</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">__nonzero__</span>(<span class="pl-s1">self</span>)
   <span class="pl-c1">1572</span>         <span class="pl-k">raise</span> <span class="pl-v">ValueError</span>(<span class="pl-s">"The truth value of a {0} is ambiguous. "</span>
   <span class="pl-c1">1573</span>                          <span class="pl-s">"Use a.empty, a.bool(), a.item(), a.any() or a.all()."</span>
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1574</span>                          .<span class="pl-en">format</span>(<span class="pl-s1">self</span>.<span class="pl-s1">__class__</span>.<span class="pl-s1">__name__</span>))
   <span class="pl-c1">1575</span> 
   <span class="pl-c1">1576</span>     <span class="pl-s1">__bool__</span> <span class="pl-c1">=</span> <span class="pl-s1">__nonzero__</span>

<span class="pl-v">ValueError</span>: <span class="pl-v">The</span> <span class="pl-s1">truth</span> <span class="pl-s1">value</span> <span class="pl-s1">of</span> <span class="pl-s1">a</span> <span class="pl-v">Series</span> <span class="pl-c1">is</span> <span class="pl-s1">ambiguous</span>. <span class="pl-v">Use</span> <span class="pl-s1">a</span>.<span class="pl-s1">empty</span>, <span class="pl-s1">a</span>.<span class="pl-en">bool</span>(), <span class="pl-s1">a</span>.<span class="pl-en">item</span>(), <span class="pl-s1">a</span>.<span class="pl-en">any</span>() <span class="pl-c1">or</span> <span class="pl-s1">a</span>.<span class="pl-en">all</span>().</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto"><code class="notranslate">first_valid_index</code> did not raise on a row index with duplicate values on pandas &lt;= 0.22.0</p>
<h4 dir="auto">Expected Output</h4>
<p dir="auto"><code class="notranslate">0</code></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.4.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 4.1.35-pv-ts2<br>
machine: x86_64<br>
processor:<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: en_US.UTF-8<br>
LOCALE: en_US.UTF-8</p>
<p dir="auto">pandas: 0.23.0<br>
pytest: 3.2.1<br>
pip: 9.0.1<br>
setuptools: 36.4.0<br>
Cython: None<br>
numpy: 1.12.1<br>
scipy: 0.19.1<br>
pyarrow: 0.8.0<br>
xarray: None<br>
IPython: 6.1.0<br>
sphinx: 1.7.5<br>
patsy: 0.4.1<br>
dateutil: 2.6.1<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: None<br>
tables: 3.4.2<br>
numexpr: 2.6.2<br>
feather: None<br>
matplotlib: 2.0.2<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: 4.6.0<br>
html5lib: 0.9999999<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.6<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jreback/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jreback">@jreback</a></p>