[Numpy-discussion] object to string for numpy 1.3.0

Thomas Robitaille thomas.robitaille@gmail....
Fri Nov 6 14:39:01 CST 2009


Hello,

Until recently, object to string conversion was buggy:

In [1]: import numpy as np

In [2]: a = np.array(['4TxismCut','nXe4f0sAs'],dtype=np.object_)

In [3]: np.array(a,dtype='|S9')
Out[3]:
array(['4TxismCun', 'Xe4f0sAs'],
       dtype='|S9')

(notice the strings are not quite the same)

This is now fixed in svn, but is there a way to write the conversion  
differently such that it does work with numpy 1.3.0? (so as not to  
have to force users of a package to upgrade to numpy 1.4.0)

Thanks,

Thomas


More information about the NumPy-Discussion mailing list