nunique is slower than len(set(x.dropna())) for smaller Series. · Issue #7771 · pandas-dev/pandas (original) (raw)
This is biting me when applying nunique on some groupby operations.
In one benchmark, which I'll shortly share, nunique() is slower until we get to a length of 3000.