1>>> index = pd.Index([3, 1, 2, 3, 4, np.nan])
2>>> index.value_counts()
33.0 2
44.0 1
52.0 1
61.0 1
7dtype: int64
8
1>>> df.set_index(["Person", "Single"]).count(level="Person")
2 Age
3Person
4John 2
5Lewis 1
6Myla 1
7