Examples

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