wesm/pandas — Issue #714: Series.unique() dies with many NaNs
Author: kieranholland
Created: 2012-01-30 11:08:22+00:00
State: open

Series.unique() dies with many NaNs:

import time

def test_unique(obj):
for n in range(6):
objs = Series([obj] * 10 ** n)
start = time.time()
objs.unique()
stop = time.time()
print('%6.0f %s' % (len(objs), stop - start))

test_unique('a')

1 4.98294830322e-05
10 2.40802764893e-05
100 4.10079956055e-05
1000 6.91413879395e-05
10000 0.000164985656738
100000 0.0013279914856

test_unique(float('nan'))

1 3.91006469727e-05
10 3.60012054443e-05
100 0.000331163406372
1000 0.0283088684082
10000 2.71325206757
100000 Boom!