[Numpy-discussion] NumPy types --> Numeric typecodes map?

Francesc Altet faltet at carabos.com
Mon Sep 25 12:18:14 CDT 2006


El dl 25 de 09 del 2006 a les 11:08 -0600, en/na Travis Oliphant va
escriure:
> Francesc Altet wrote:
> 
> >Hi,
> >
> >Anybody know if there is a map between NumPy types and Numeric
> >typecodes? Something like 'typecodes' for numarray:
> >  
> >
> How about
> 
> dtype(obj).char?

This doesn't work for many types:

>>> Numeric.array([1], typecode=numpy.dtype('int32').char)
array([1])

this is fine, but:

>>> Numeric.array([1], typecode=numpy.dtype('int16').char)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: typecode argument must be a valid type.
>>> Numeric.array([1], typecode=numpy.dtype('int64').char)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: typecode argument must be a valid type.


Anyway, this is not very important as I can do my own map internally.

Thanks,

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"






More information about the Numpy-discussion mailing list