[Numpy-discussion] recarray slow?
Pierre GM
pgmdevlist at gmail.com
Wed Jul 21 16:29:54 EDT 2010
On Jul 21, 2010, at 4:22 PM, wheres pythonmonks wrote:
> However: is there an automatic way to convert a named index to a position?
>
> What about looping over tuples of my recarray:
>
> for t in d:
> date = t['Date']
> ....
Why don't you use zip ?
>>> for (date, t) in (d['Date'], d)
That way, you save repetitive calls to __getitem__....
> Should I create a map from dtype.names(), and use that to look up the
> index based on the name in advance? (if I really really want to
> factorize out the lookup of 'Date']
Meh. I have a bad feeling about it that it won't be really performant.
More information about the NumPy-Discussion
mailing list