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

Brennan Williams brennan.williams@visualreservoir....
Thu May 7 18:36:09 CDT 2009


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?

Thanks

Brennan



More information about the Numpy-discussion mailing list