Examples
import numpy as np import pandas as pd
df = pd.DataFrame({'P': [2, 3, 4], 'Q': [2, 2, 2]}) df.nunique()
P 3 Q 1 dtype: int64
df.nunique(axis=1)
0 1 1 2 2 2 dtype: int64