<p dir="auto">Replicating example</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [1]: df = pd.DataFrame([[1,2],[3,4]],columns=pd.CategoricalIndex(list('AB')))

In [2]: df.describe()
AttributeError: 'DataFrame' object has no attribute 'value_counts'"><pre class="notranslate"><code class="notranslate">In [1]: df = pd.DataFrame([[1,2],[3,4]],columns=pd.CategoricalIndex(list('AB')))

In [2]: df.describe()
AttributeError: 'DataFrame' object has no attribute 'value_counts'
</code></pre></div>
<p dir="auto">The behaviour in <a href="https://gist.github.com/williamsmj/c6cbabcb25f27f08407f">this notebook</a> seems like a bug to me. This is pandas 0.17.0.</p>
<p dir="auto">In it, <code class="notranslate">g</code> and <code class="notranslate">gcat</code> are the results of two <code class="notranslate">df.groupby(['medium', 'artist']).count().unstack()</code> operations. The only difference is that one of those operations is on <code class="notranslate">df</code> where one of the columns that the <code class="notranslate">groupby</code> operates over has been converted to Categorical.</p>
<p dir="auto"><code class="notranslate">g</code> and <code class="notranslate">gcat</code> behave very differently. I've tried to pin this down to the exact operation in the split-apply-combine that causes the problem without much luck.</p>
<p dir="auto">Slicing a column out of <code class="notranslate">g</code> returns a Series as expected, while slicing a column out of <code class="notranslate">gcat</code> returns a DataFrame (see cells 4 and 5).</p>
<p dir="auto"><code class="notranslate">g.describe()</code> works as expected, but <code class="notranslate">gcat.describe()</code> raises the exception</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="AttributeError: 'DataFrame' object has no attribute 'value_counts'"><pre class="notranslate"><code class="notranslate">AttributeError: 'DataFrame' object has no attribute 'value_counts'
</code></pre></div>
<p dir="auto">and <code class="notranslate">g['painting'] + g['sculpture']</code> works as expected but <code class="notranslate">g['painting'] + g['sculpture']</code> raises</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Exception: Data must be 1-dimensional"><pre class="notranslate"><code class="notranslate">Exception: Data must be 1-dimensional
</code></pre></div>
<p dir="auto">Hard to reprod.</p>
<p dir="auto">Select from a duplicate indexed axis in a frame with ix where part of the<br>
selection set is missing</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [22]: df = DataFrame(np.random.randn(5,5),columns=['A.1','B.1','B.2','B.3','A.2'],index=date_range('20130101',periods=5))

In [23]: df2 = df.rename(columns=lambda x: x.split('.')[0])

In [24]: df2
Out[24]: 
                   A         B         B         B         A
2013-01-01 -1.029245 -0.782139  0.584956  1.097301 -0.150675
2013-01-02 -0.723246 -0.356150 -0.441952  0.027012 -1.851583
2013-01-03 -1.001412  0.129464  0.093433  0.952615 -1.338390
2013-01-04  0.165987  0.227918  0.557940 -0.102501 -1.194053
2013-01-05  0.249493 -1.102096 -0.977755 -0.529540  0.783277

[5 rows x 5 columns]

In [25]: df2.ix[:,['A','B','C']]

AssertionError: Number of manager items must equal union of block items
# manager items: 6, # tot_items: 14"><pre class="notranslate"><code class="notranslate">In [22]: df = DataFrame(np.random.randn(5,5),columns=['A.1','B.1','B.2','B.3','A.2'],index=date_range('20130101',periods=5))

In [23]: df2 = df.rename(columns=lambda x: x.split('.')[0])

In [24]: df2
Out[24]: 
                   A         B         B         B         A
2013-01-01 -1.029245 -0.782139  0.584956  1.097301 -0.150675
2013-01-02 -0.723246 -0.356150 -0.441952  0.027012 -1.851583
2013-01-03 -1.001412  0.129464  0.093433  0.952615 -1.338390
2013-01-04  0.165987  0.227918  0.557940 -0.102501 -1.194053
2013-01-05  0.249493 -1.102096 -0.977755 -0.529540  0.783277

[5 rows x 5 columns]

In [25]: df2.ix[:,['A','B','C']]

AssertionError: Number of manager items must equal union of block items
# manager items: 6, # tot_items: 14
</code></pre></div>