<p dir="auto">As discussed in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="181923776" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/14384" data-hovercard-type="pull_request" data-hovercard-url="/pandas-dev/pandas/pull/14384/hovercard?comment_id=82538778&amp;comment_type=review_comment" href="https://github.com/pandas-dev/pandas/pull/14384#discussion_r82538778">#14384 (comment)</a>.</p>
<h4 dir="auto">A small, complete example of the issue</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd 
df1 = pd.DataFrame({'a': [1, 2, 3]})
df2 = pd.DataFrame({'b': [2,3,4]})
df = pd.concat([df1, df1, df2], axis=1).to_sparse()
df.index = [1, 2, 3]
df.loc[1, 'a'] = 3"><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-s1">df1</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">'a'</span>: [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>]})
<span class="pl-s1">df2</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">2</span>,<span class="pl-c1">3</span>,<span class="pl-c1">4</span>]})
<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">concat</span>([<span class="pl-s1">df1</span>, <span class="pl-s1">df1</span>, <span class="pl-s1">df2</span>], <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>).<span class="pl-en">to_sparse</span>()
<span class="pl-s1">df</span>.<span class="pl-s1">index</span> <span class="pl-c1">=</span> [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>]
<span class="pl-s1">df</span>.<span class="pl-s1">loc</span>[<span class="pl-c1">1</span>, <span class="pl-s">'a'</span>] <span class="pl-c1">=</span> <span class="pl-c1">3</span></pre></div>
<p dir="auto">errors with</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="AttributeError                            Traceback (most recent call last)
&lt;ipython-input-6-0a670748626a&gt; in &lt;module&gt;()
      4 df = pd.concat([df1, df1, df2], axis=1).to_sparse()
      5 df.index = [1, 2, 3]
----&gt; 6 df.loc[1, 'a'] = 3

/Users/bkandel/.virtualenvs/pandas_19/lib/python2.7/site-packages/pandas/core/indexing.pyc in __setitem__(self, key, value)
    138             key = com._apply_if_callable(key, self.obj)
    139         indexer = self._get_setitem_indexer(key)
--&gt; 140         self._setitem_with_indexer(indexer, value)
    141 
    142     def _has_valid_type(self, k, axis):

/Users/bkandel/.virtualenvs/pandas_19/lib/python2.7/site-packages/pandas/core/indexing.pyc in _setitem_with_indexer(self, indexer, value)
    545                 # scalar
    546                 for item in labels:
--&gt; 547                     setter(item, value)
    548 
    549         else:

/Users/bkandel/.virtualenvs/pandas_19/lib/python2.7/site-packages/pandas/core/indexing.pyc in setter(item, v)
    453 
    454             def setter(item, v):
--&gt; 455                 s = self.obj[item]
    456                 pi = plane_indexer[0] if lplane_indexer == 1 else plane_indexer
    457 

/Users/bkandel/.virtualenvs/pandas_19/lib/python2.7/site-packages/pandas/sparse/frame.pyc in __getitem__(self, key)
    345             return self._getitem_array(key)
    346         else:
--&gt; 347             return self._get_item_cache(key)
    348 
    349     @Appender(DataFrame.get_value.__doc__, indents=0)

/Users/bkandel/.virtualenvs/pandas_19/lib/python2.7/site-packages/pandas/core/generic.pyc in _get_item_cache(self, item)
   1385         if res is None:
   1386             values = self._data.get(item)
-&gt; 1387             res = self._box_item_values(item, values)
   1388             cache[item] = res
   1389             res._set_as_cached(item, self)

/Users/bkandel/.virtualenvs/pandas_19/lib/python2.7/site-packages/pandas/core/frame.pyc in _box_item_values(self, key, values)
   2392         items = self.columns[self.columns.get_loc(key)]
   2393         if values.ndim == 2:
-&gt; 2394             return self._constructor(values.T, columns=items, index=self.index)
   2395         else:
   2396             return self._box_col_values(values, items)

AttributeError: 'BlockManager' object has no attribute 'T'"><pre class="notranslate"><span class="pl-v">AttributeError</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-c1">0</span><span class="pl-s1">a670748626a</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">4</span> <span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">concat</span>([<span class="pl-s1">df1</span>, <span class="pl-s1">df1</span>, <span class="pl-s1">df2</span>], <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>).<span class="pl-en">to_sparse</span>()
      <span class="pl-c1">5</span> <span class="pl-s1">df</span>.<span class="pl-s1">index</span> <span class="pl-c1">=</span> [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</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">6</span> <span class="pl-s1">df</span>.<span class="pl-s1">loc</span>[<span class="pl-c1">1</span>, <span class="pl-s">'a'</span>] <span class="pl-c1">=</span> <span class="pl-c1">3</span>

<span class="pl-c1">/</span><span class="pl-v">Users</span><span class="pl-c1">/</span><span class="pl-s1">bkandel</span><span class="pl-c1">/</span>.<span class="pl-s1">virtualenvs</span><span class="pl-c1">/</span><span class="pl-s1">pandas_19</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</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">indexing</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">__setitem__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">key</span>, <span class="pl-s1">value</span>)
    <span class="pl-c1">138</span>             <span class="pl-s1">key</span> <span class="pl-c1">=</span> <span class="pl-s1">com</span>.<span class="pl-en">_apply_if_callable</span>(<span class="pl-s1">key</span>, <span class="pl-s1">self</span>.<span class="pl-s1">obj</span>)
    <span class="pl-c1">139</span>         <span class="pl-s1">indexer</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_get_setitem_indexer</span>(<span class="pl-s1">key</span>)
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">140</span>         <span class="pl-s1">self</span>.<span class="pl-en">_setitem_with_indexer</span>(<span class="pl-s1">indexer</span>, <span class="pl-s1">value</span>)
    <span class="pl-c1">141</span> 
    <span class="pl-c1">142</span>     <span class="pl-k">def</span> <span class="pl-en">_has_valid_type</span>(<span class="pl-s1">self</span>, <span class="pl-s1">k</span>, <span class="pl-s1">axis</span>):

<span class="pl-c1">/</span><span class="pl-v">Users</span><span class="pl-c1">/</span><span class="pl-s1">bkandel</span><span class="pl-c1">/</span>.<span class="pl-s1">virtualenvs</span><span class="pl-c1">/</span><span class="pl-s1">pandas_19</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</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">indexing</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">_setitem_with_indexer</span>(<span class="pl-s1">self</span>, <span class="pl-s1">indexer</span>, <span class="pl-s1">value</span>)
    <span class="pl-c1">545</span>                 <span class="pl-c"># scalar</span>
    <span class="pl-c1">546</span>                 <span class="pl-k">for</span> <span class="pl-s1">item</span> <span class="pl-c1">in</span> <span class="pl-s1">labels</span>:
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">547</span>                     <span class="pl-en">setter</span>(<span class="pl-s1">item</span>, <span class="pl-s1">value</span>)
    <span class="pl-c1">548</span> 
    <span class="pl-c1">549</span>         <span class="pl-s1">else</span>:

<span class="pl-c1">/</span><span class="pl-v">Users</span><span class="pl-c1">/</span><span class="pl-s1">bkandel</span><span class="pl-c1">/</span>.<span class="pl-s1">virtualenvs</span><span class="pl-c1">/</span><span class="pl-s1">pandas_19</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</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">indexing</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">setter</span>(<span class="pl-s1">item</span>, <span class="pl-s1">v</span>)
    <span class="pl-c1">453</span> 
    <span class="pl-c1">454</span>             <span class="pl-k">def</span> <span class="pl-en">setter</span>(<span class="pl-s1">item</span>, <span class="pl-s1">v</span>):
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">455</span>                 <span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">obj</span>[<span class="pl-s1">item</span>]
    <span class="pl-c1">456</span>                 <span class="pl-s1">pi</span> <span class="pl-c1">=</span> <span class="pl-s1">plane_indexer</span>[<span class="pl-c1">0</span>] <span class="pl-k">if</span> <span class="pl-s1">lplane_indexer</span> <span class="pl-c1">==</span> <span class="pl-c1">1</span> <span class="pl-k">else</span> <span class="pl-s1">plane_indexer</span>
    <span class="pl-c1">457</span> 

<span class="pl-c1">/</span><span class="pl-v">Users</span><span class="pl-c1">/</span><span class="pl-s1">bkandel</span><span class="pl-c1">/</span>.<span class="pl-s1">virtualenvs</span><span class="pl-c1">/</span><span class="pl-s1">pandas_19</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</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">sparse</span><span class="pl-c1">/</span><span class="pl-s1">frame</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">__getitem__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">key</span>)
    <span class="pl-c1">345</span>             <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_getitem_array</span>(<span class="pl-s1">key</span>)
    <span class="pl-c1">346</span>         <span class="pl-s1">else</span>:
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">347</span>             <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_get_item_cache</span>(<span class="pl-s1">key</span>)
    <span class="pl-c1">348</span> 
    <span class="pl-c1">349</span>     @<span class="pl-v">Appender</span>(<span class="pl-v">DataFrame</span>.<span class="pl-s1">get_value</span>.<span class="pl-s1">__doc__</span>, <span class="pl-s1">indents</span><span class="pl-c1">=</span><span class="pl-c1">0</span>)

<span class="pl-c1">/</span><span class="pl-v">Users</span><span class="pl-c1">/</span><span class="pl-s1">bkandel</span><span class="pl-c1">/</span>.<span class="pl-s1">virtualenvs</span><span class="pl-c1">/</span><span class="pl-s1">pandas_19</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</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">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">_get_item_cache</span>(<span class="pl-s1">self</span>, <span class="pl-s1">item</span>)
   <span class="pl-c1">1385</span>         <span class="pl-k">if</span> <span class="pl-s1">res</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span>:
   <span class="pl-c1">1386</span>             <span class="pl-s1">values</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">_data</span>.<span class="pl-en">get</span>(<span class="pl-s1">item</span>)
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1387</span>             <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_box_item_values</span>(<span class="pl-s1">item</span>, <span class="pl-s1">values</span>)
   <span class="pl-c1">1388</span>             <span class="pl-s1">cache</span>[<span class="pl-s1">item</span>] <span class="pl-c1">=</span> <span class="pl-s1">res</span>
   <span class="pl-c1">1389</span>             <span class="pl-s1">res</span>.<span class="pl-en">_set_as_cached</span>(<span class="pl-s1">item</span>, <span class="pl-s1">self</span>)

<span class="pl-c1">/</span><span class="pl-v">Users</span><span class="pl-c1">/</span><span class="pl-s1">bkandel</span><span class="pl-c1">/</span>.<span class="pl-s1">virtualenvs</span><span class="pl-c1">/</span><span class="pl-s1">pandas_19</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</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">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">_box_item_values</span>(<span class="pl-s1">self</span>, <span class="pl-s1">key</span>, <span class="pl-s1">values</span>)
   <span class="pl-c1">2392</span>         <span class="pl-s1">items</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">columns</span>[<span class="pl-s1">self</span>.<span class="pl-s1">columns</span>.<span class="pl-en">get_loc</span>(<span class="pl-s1">key</span>)]
   <span class="pl-c1">2393</span>         <span class="pl-k">if</span> <span class="pl-s1">values</span>.<span class="pl-s1">ndim</span> <span class="pl-c1">==</span> <span class="pl-c1">2</span>:
<span class="pl-c1">-&gt;</span> <span class="pl-c1">2394</span>             <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_constructor</span>(<span class="pl-s1">values</span>.<span class="pl-v">T</span>, <span class="pl-s1">columns</span><span class="pl-c1">=</span><span class="pl-s1">items</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-c1">2395</span>         <span class="pl-k">else</span>:
   <span class="pl-c1">2396</span>             <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_box_col_values</span>(<span class="pl-s1">values</span>, <span class="pl-s1">items</span>)

<span class="pl-v">AttributeError</span>: <span class="pl-s">'BlockManager'</span> <span class="pl-s1">object</span> <span class="pl-s1">has</span> <span class="pl-s1">no</span> <span class="pl-s1">attribute</span> <span class="pl-s">'T'</span></pre></div>
<h4 dir="auto">Expected Output</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="   a  a  b
1  3  3  2
2  2  2  3
3  3  3  4"><pre class="notranslate">   <span class="pl-s1">a</span>  <span class="pl-s1">a</span>  <span class="pl-s1">b</span>
<span class="pl-c1">1</span>  <span class="pl-c1">3</span>  <span class="pl-c1">3</span>  <span class="pl-c1">2</span>
<span class="pl-c1">2</span>  <span class="pl-c1">2</span>  <span class="pl-c1">2</span>  <span class="pl-c1">3</span>
<span class="pl-c1">3</span>  <span class="pl-c1">3</span>  <span class="pl-c1">3</span>  <span class="pl-c1">4</span></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
## INSTALLED VERSIONS
<p dir="auto">commit: None<br>
python: 2.7.10.final.0<br>
python-bits: 64<br>
OS: Darwin<br>
OS-release: 14.5.0<br>
machine: x86_64<br>
processor: i386<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: None<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.19.0<br>
nose: None<br>
pip: 8.1.2<br>
setuptools: 28.3.0<br>
Cython: None<br>
numpy: 1.11.2<br>
scipy: None<br>
statsmodels: None<br>
xarray: None<br>
IPython: 5.1.0<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.5.3<br>
pytz: 2016.7<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
matplotlib: None<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: None<br>
httplib2: None<br>
apiclient: None<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: None<br>
boto: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">The following code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import pandas as pd
p1 = {'name': 'willy', 'age': 10}
p2 = {'name': 'willy', 'age': 11}
p3 = {'name': 'zoe', 'age': 10}
df = pd.DataFrame([p1, p2, p3])
df = df[['name','name','age']]
df.groupby('name')"><pre class="notranslate"><code class="notranslate">import pandas as pd
p1 = {'name': 'willy', 'age': 10}
p2 = {'name': 'willy', 'age': 11}
p3 = {'name': 'zoe', 'age': 10}
df = pd.DataFrame([p1, p2, p3])
df = df[['name','name','age']]
df.groupby('name')
</code></pre></div>
<p dir="auto">gives the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: 'DataFrame' object is not callable"><pre class="notranslate"><code class="notranslate">TypeError: 'DataFrame' object is not callable
</code></pre></div>
<p dir="auto">Instead, it should say "Cannot groupby a column which exists more than once"</p>