[Numpy-discussion] Astype and strings
Travis Oliphant
oliphant at enthought.com
Tue Oct 27 15:59:04 EDT 2009
On Oct 26, 2009, at 9:54 AM, Eli Bressert wrote:
> Hi Everyone,
>
> Is Numpy supposed to behave this like this when converting an array of
> numbers to an array of strings with astype?
In general you have to tell NumPy how big the string should be (i.e.
np.str is generic).
There are a few places where NumPy will look at the data you have in
order to guess a size, but as you've seen astype is not one of those
places.
I think astype could be fixed (by putting a special-case check in the
current code for conversion to an unspecified-length string), but that
has not been implemented.
Please file a feature enhancement issue on the Trac so we don't lose
sight of this.
-Travis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20091027/c2192943/attachment.html>
More information about the NumPy-Discussion
mailing list