You can quickly access the first level of multiindex columns using the dot operator. Similar to how you will access columns with an index of the same level.
just add .aisle_idto the end. Or equivalently['aisle_id']
tmp.head(1000).groupby(['user_id', 'aisle_id']).agg({'aisle_id': ['count']}) \
.aisle_id
count
user_id aisle_id
381 38 1
382 84 2
115 1
3107 43 1
3321 37 1
69 2
Reply to comment
@displayname df.aisle_id df.xs('aisle_id'). , , aisle_id. , , , . , , , , aisle_id df.aisle_id. ScottBoston , , , aisle_id.