wesm/pandas — Issue #263: Cannot represent empty MultiIndex
Author: asqui
Created: 2011-10-20 15:49:22+00:00
State: open

An empty MultiIndex cannot be constructed:

```
In [120]: pa.MultiIndex([],[])
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
C:\Users\dfortunov\ in ()
----> 1 pa.MultiIndex([],[])

C:\VirtualEnvs\mss.dev\lib\site-packages\pandas-0.5.0.dev20111019_17461b7-py2.6-win32.egg\pandas\core\index.pyc in __new
__(cls, levels, labels, sortorder, names)
833 assert(len(levels) == len(labels))
834 if len(levels) == 0:
--> 835 raise Exception('Must pass non-zero number of levels/labels')
836
837 if len(levels) == 1:

Exception: Must pass non-zero number of levels/labels
```

This does not maintain parity with regular indices, where an empty index may be constructed:
```
In [119]: pa.Index([])
Out[119]: Index([], dtype=object)
```

And causes problems when doing set operations with MultiIndexes.