Fix shape attribute for MultiIndex by shoyer · Pull Request #8609 · pandas-dev/pandas (original) (raw)

@jreback here's what I found on master:

In [1]: import pandas as pd

In [2]: idx = pd.MultiIndex.from_arrays([['a', 'b'], [0, 1]])

In [3]: idx
Out[3]:
MultiIndex(levels=[[u'a', u'b'], [0, 1]],
           labels=[[0, 1], [0, 1]])

In [4]: idx.shape
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-f9305225184b> in <module>()
----> 1 idx.shape

/Users/shoyer/dev/pandas/pandas/core/base.pyc in shape(self)
    298     def shape(self):
    299         """ return a tuple of the shape of the underlying data """
--> 300         return self._data.shape
    301
    302     @property

AttributeError: 'NoneType' object has no attribute 'shape'