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

Travis Oliphant oliphant at ee.byu.edu
Mon Sep 25 13:41:53 EDT 2006


Francesc Altet wrote:

>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:
>>>      
>>>

Oh, you mean actual Numeric typecodes, not Numeric-like typecodes :-)

dtype(obj).char will not work for the Numeric typecodes that changed, 
set up a dictionary-like object which uses dtype(obj).char on all but 
the ones that changed is my suggestion.   See the core/numerictypes.py 
module for dictionary-like objects.   Perhaps this would be a good thing 
to add to numpy/oldnumeric


'b' --> 'B'
'1' --> 'b'
's' --> 'h'
'w' --> 'H'
'u' --> 'I'


-Travis





More information about the NumPy-Discussion mailing list