I have been unsuccessful in reproducing the hierarchical indexing example on page 148 of Wes McKinney's "Python for Data Analysis" book. I am currently using python 2.7 on Mac OS X 10.8.2. (I have the same problem on ubuntu precise as well with pandas 0.7-0.10).
Any and all help is appreciated.
frame = pd.DataFrame(np.arange(12).reshape((4, 3)), index = list('aabb'),
columns = [['Ohio', 'Ohio', 'Colorado']['Green', 'Red', 'Green']])
Error message:
TypeError Traceback (most recent call last)
<ipython-input-27-681f4740a561> in <module>()
1 frame = pd.DataFrame(np.arange(12).reshape((4, 3)), index = list('aabb'),
----> 2 columns = [['Ohio', 'Ohio', 'Colorado']['Green', 'Red', 'Green']])
TypeError: list indices must be integers, not tuple
FYI I am using version 0.9 of the pandas library:
pd.__version__
'0.9.0rc1'