[Numpy-discussion] Migrating Char arrays

Francesc Alted falted at openlc.org
Tue Sep 30 09:42:05 EDT 2003

Hi Marc,

A Dimarts 30 Setembre 2003 18:21, Marc Poinot va escriure:
> Is there something in numarray that could replace the Numeric interface
> for this string type? Is it difficult to add a 'Character' type?
> Is the (undocumented) CharArrayType the solution for this?

Yes, it is. See:

>>> from numarray import strings
>>> strings.array(["asd", "aa"])
CharArray(['asd', 'aa'])
>>> a=strings.array(["asd", "aa"])
>>> a[1]
>>> a.raw()[1]   # If you want to get *all* spaces and nulls in strings
'aa '

This is undocumented in the manual, but it's quite well described in the doc

>>> help(strings.array)


Francesc Alted

More information about the NumPy-Discussion mailing list