I created a multiIndex DataFrame by:
df.set_index(['Field1', 'Field2'], inplace=True)
If this is not a multiIndex DataFrame please tell me how to make one.
I want to:
- Group by the same columns that are in the index
- Aggregate a count of each group
- Then return the whole thing as a Series with Field1 and Field2 as the index
How do I go about doing this?
ADDITIONAL INFO
I have a multiIndex dataFrame that looks like this:
Continent Sector Count
Asia 1 4
2 1
Australia 1 1
Europe 1 1
2 3
3 2
North America 1 1
5 1
South America 5 1
How can I return this as a Series with the index of [Continent, Sector]