<p dir="auto">The behaviour below occurs in versions <code class="notranslate">'0.15.0rc1-21-g32c5016'</code> and <code class="notranslate">'0.14.1'</code>.</p>
<p dir="auto">When the <code class="notranslate">label</code> passed to the <code class="notranslate">drop</code> method of a <code class="notranslate">Series</code> is not in the index:<br>
(a) if the index is not all booleans then an error is raised<br>
(b) if the index is all booleans and has length &gt; 1 then no error is raised; the original series is returned<br>
(c) if the index is all booleans and has length == 1 then an error is raised</p>
<p dir="auto">I propose that:</p>
<ol dir="auto">
<li>the difference between the behaviour in (a) and (b) should be documented</li>
<li>the behaviour in (c) should be changed to match that in (b)</li>
</ol>
<p dir="auto">Examples of current behaviour:<br>
(a)</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; pd.Series([1, 1], index=['a', True]).drop(False)
ValueError: labels [False] not contained in axis"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>([<span class="pl-c1">1</span>, <span class="pl-c1">1</span>], <span class="pl-s1">index</span><span class="pl-c1">=</span>[<span class="pl-s">'a'</span>, <span class="pl-c1">True</span>]).<span class="pl-en">drop</span>(<span class="pl-c1">False</span>)
<span class="pl-v">ValueError</span>: <span class="pl-s1">labels</span> [<span class="pl-c1">False</span>] <span class="pl-c1">not</span> <span class="pl-s1">contained</span> <span class="pl-c1">in</span> <span class="pl-s1">axis</span></pre></div>
<p dir="auto">(b)</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; pd.Series([1, 1], index=[True, True]).drop(False)
True    1
True    1
dtype: int64"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>([<span class="pl-c1">1</span>, <span class="pl-c1">1</span>], <span class="pl-s1">index</span><span class="pl-c1">=</span>[<span class="pl-c1">True</span>, <span class="pl-c1">True</span>]).<span class="pl-en">drop</span>(<span class="pl-c1">False</span>)
<span class="pl-c1">True</span>    <span class="pl-c1">1</span>
<span class="pl-c1">True</span>    <span class="pl-c1">1</span>
<span class="pl-s1">dtype</span>: <span class="pl-s1">int64</span></pre></div>
<p dir="auto">(c)</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; pd.Series([1], index=[True]).drop(False)
ValueError: labels [False] not contained in axis"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>([<span class="pl-c1">1</span>], <span class="pl-s1">index</span><span class="pl-c1">=</span>[<span class="pl-c1">True</span>]).<span class="pl-en">drop</span>(<span class="pl-c1">False</span>)
<span class="pl-v">ValueError</span>: <span class="pl-s1">labels</span> [<span class="pl-c1">False</span>] <span class="pl-c1">not</span> <span class="pl-s1">contained</span> <span class="pl-c1">in</span> <span class="pl-s1">axis</span></pre></div>
<p dir="auto">Hello,</p>
<p dir="auto">The following code ran perfectly fine on 0.14.1, but breaks on 0.15 RC1, raising<br>
ValueError: cannot reindex from a duplicate axis.<br>
Is it a bug or an intended change of behaviour? Thanks.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd
import numpy as np
d = {'Quantity' : pd.Series([1., 2., 3., 4., 5.],
                         index=['foo', 'foo', 'foo', 'foo', 'bar']),
     'Group' : pd.Series([1, 2, 1, 2, 1], index=['foo', 'foo', 'foo', 'foo', 'bar'])}

df = pd.DataFrame(d)
groups = df.groupby([df.index, 'Group'], sort=False, as_index=True)

temp = groups['Quantity'].apply(lambda x: x+np.roll(x, 1))

df['QuantityApplied'] = temp"><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-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-s1">d</span> <span class="pl-c1">=</span> {<span class="pl-s">'Quantity'</span> : <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>([<span class="pl-c1">1.</span>, <span class="pl-c1">2.</span>, <span class="pl-c1">3.</span>, <span class="pl-c1">4.</span>, <span class="pl-c1">5.</span>],
                         <span class="pl-s1">index</span><span class="pl-c1">=</span>[<span class="pl-s">'foo'</span>, <span class="pl-s">'foo'</span>, <span class="pl-s">'foo'</span>, <span class="pl-s">'foo'</span>, <span class="pl-s">'bar'</span>]),
     <span class="pl-s">'Group'</span> : <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>([<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">1</span>], <span class="pl-s1">index</span><span class="pl-c1">=</span>[<span class="pl-s">'foo'</span>, <span class="pl-s">'foo'</span>, <span class="pl-s">'foo'</span>, <span class="pl-s">'foo'</span>, <span class="pl-s">'bar'</span>])}

<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">d</span>)
<span class="pl-s1">groups</span> <span class="pl-c1">=</span> <span class="pl-s1">df</span>.<span class="pl-en">groupby</span>([<span class="pl-s1">df</span>.<span class="pl-s1">index</span>, <span class="pl-s">'Group'</span>], <span class="pl-s1">sort</span><span class="pl-c1">=</span><span class="pl-c1">False</span>, <span class="pl-s1">as_index</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)

<span class="pl-s1">temp</span> <span class="pl-c1">=</span> <span class="pl-s1">groups</span>[<span class="pl-s">'Quantity'</span>].<span class="pl-en">apply</span>(<span class="pl-k">lambda</span> <span class="pl-s1">x</span>: <span class="pl-s1">x</span><span class="pl-c1">+</span><span class="pl-s1">np</span>.<span class="pl-en">roll</span>(<span class="pl-s1">x</span>, <span class="pl-c1">1</span>))

<span class="pl-s1">df</span>[<span class="pl-s">'QuantityApplied'</span>] <span class="pl-c1">=</span> <span class="pl-s1">temp</span></pre></div>
<p dir="auto">Pandas 0.15.0 RC1</p>