<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
from decimal import Decimal
df = pd.DataFrame({'id': [1], 'x': [1], 'y': [Decimal(1)]})
df.groupby('id')[['x', 'y']].sum()

#     x
# id   
# 1   1"><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">from</span> <span class="pl-s1">decimal</span> <span class="pl-k">import</span> <span class="pl-v">Decimal</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-s">'id'</span>: [<span class="pl-c1">1</span>], <span class="pl-s">'x'</span>: [<span class="pl-c1">1</span>], <span class="pl-s">'y'</span>: [<span class="pl-v">Decimal</span>(<span class="pl-c1">1</span>)]})
<span class="pl-s1">df</span>.<span class="pl-en">groupby</span>(<span class="pl-s">'id'</span>)[[<span class="pl-s">'x'</span>, <span class="pl-s">'y'</span>]].<span class="pl-en">sum</span>()

<span class="pl-c">#     x</span>
<span class="pl-c"># id   </span>
<span class="pl-c"># 1   1</span></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">I unknowingly encountered the feature described <a href="http://pandas.pydata.org/pandas-docs/stable/groupby.html#automatic-exclusion-of-nuisance-columns" rel="nofollow">here</a> when running the above code. While I see how this can be a useful feature, it's a nuisance not knowing that it happened and that I can't disable it. I feel that in the case of doing a groupby on explicitly selected columns <code class="notranslate">groupby(...)[COLS]</code>, it should not drop any columns and let whatever errors that occur raise. I also think that a warning could be added and/or an option to disable the feature.</p>
<h4 dir="auto">Expected Output</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#     x  y
# id   
# 1   1  1"><pre class="notranslate"><code class="notranslate">#     x  y
# id   
# 1   1  1
</code></pre></div>
<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.2.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 3.10.0-327.10.1.el7.x86_64<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: None<br>
LOCALE: None.None<br>
pandas: 0.22.0<br>
pytest: 3.2.1<br>
pip: 9.0.1<br>
setuptools: 36.4.0<br>
Cython: 0.28.1<br>
numpy: 1.13.1<br>
scipy: None<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.1.0<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.1<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
feather: None<br>
matplotlib: None<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: 0.9999999<br>
sqlalchemy: 1.1.13<br>
pymysql: None<br>
psycopg2: 2.7.1 (dt dec pq3 ext lo64)<br>
jinja2: 2.10<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<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; pd.CategoricalIndex(['a', 'b'], categories=['a', 'b']).equals(
...     pd.CategoricalIndex(['a', 'b'], categories=['b', 'a']))
False"><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-s1">pd</span>.<span class="pl-v">CategoricalIndex</span>([<span class="pl-s">'a'</span>, <span class="pl-s">'b'</span>], <span class="pl-s1">categories</span><span class="pl-c1">=</span>[<span class="pl-s">'a'</span>, <span class="pl-s">'b'</span>]).<span class="pl-en">equals</span>(
...     <span class="pl-s1">pd</span>.<span class="pl-v">CategoricalIndex</span>([<span class="pl-s">'a'</span>, <span class="pl-s">'b'</span>], <span class="pl-s1">categories</span><span class="pl-c1">=</span>[<span class="pl-s">'b'</span>, <span class="pl-s">'a'</span>]))
<span class="pl-c1">False</span></pre></div>
<p dir="auto">I fixed this for regular Categoricals in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="228286594" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/16339" data-hovercard-type="pull_request" data-hovercard-url="/pandas-dev/pandas/pull/16339/hovercard" href="https://github.com/pandas-dev/pandas/pull/16339">#16339</a>, but that didn't affect CategoricalIndex.equals. Do we want <code class="notranslate">.equals</code> to ignore order when <code class="notranslate">ordered=False</code> on both (I think we do)?</p>
<p dir="auto">Discovered during my CategoricalDtype refactor, which does fix it so that order is ignored when <code class="notranslate">order=False</code>.</p>