Examples
Constructing DataFrame from a dictionary:
import numpy as np
import pandas as pd
df = pd.DataFrame({"Person":
["Jhonny", "Mira", "Tom", "Jhonny", "Mira"],
"Age": [26., np.nan, 24., 35, 36],
"Single": [False, True, True, True, False]})
df
Notice the uncounted NA values:
df.count()
Counts for each row:
df.count(axis='columns')
Counts for one level of a MultiIndex:
df.set_index(["Person", "Single"]).count(level="Person")