[Numpy-discussion] replacing Nan's in a string array converted from a float array

Brennan Williams brennan.williams at visualreservoir.com
Thu May 7 20:54:54 EDT 2009


Charles R Harris wrote:
>
>
> On Thu, May 7, 2009 at 5:36 PM, Brennan Williams 
> <brennan.williams at visualreservoir.com 
> <mailto:brennan.williams at visualreservoir.com>> wrote:
>
>     I've created an array of strings using something like....
>
>                  stringarray=self.karray.astype("|S8")
>
>     If the array value is a Nan I get "1.#QNAN" in my string array.
>
>     For cosmetic reasons I'd like to change this to something else, e.g.
>     "invalid" or "inactive".
>
>     My string array can be up to 100,000+ values.
>
>     Is there a fast way to do this?
>
>
> I think this is a bug.  Making the printing of nans uniform was one of 
> the goals of numpy 1.3, although a few bits were unfixable. However, 
> this looks fixable. If you are using 1.3 please open a ticket and note 
> the OS and numpy version.
>
ok looks like numpy 1.3.0rc1 on winxp
> Chuck
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>   




More information about the NumPy-Discussion mailing list