Python: Pandas use slice with .describe() versions greater than 0.20

Viewed 895

Using this because its convenient.

http://nbviewer.jupyter.org/gist/aflaxman/436cde71f85b93638959

df = pd.DataFrame({'A': [0,0,0,0,1,1],
                   'B': [1,2,3,4,5,6],
                   'C': [8,9,10,11,12,13]})

This use to work!

This use to work!

Now:

>>> pandas.__version__
u'0.20.3'

df.groupby('A').describe().unstack()\
    .loc[:,(slice(None),['count','mean']),]

Gives:

TypeError: '['count', 'mean']' is an invalid key
1 Answers
Related