[Numpy-discussion] Enum/Factor NEP (now with code)
Bryan Van de Ven
bryanv at continuum.io
Wed Jun 13 18:20:17 EDT 2012
On 6/13/12 5:11 PM, Wes McKinney wrote:
> And retrieving group indicies/summing:
> In : %timeit arr=='a'
> 1000 loops, best of 3: 1.52 ms per loop
> In : vals = np.random.randn(1000000)
> In : inds = [arr==x for x in lets]
> In : %timeit for ind in inds: vals[ind].sum()
> 10 loops, best of 3: 48.3 ms per loop
> (FYI you're comparing an O(NK) algorithm with an O(N) algorithm for small K)
I am not familiar with the details of your groupby implementation
(evidently!), consider me appropriately chastised.
More information about the NumPy-Discussion