[Numpy-discussion] saving masked array to a text file

Guillaume Chérel guillaume.c.cherel@gmail....
Tue Sep 7 03:21:22 CDT 2010


  It works only if I can find a value belonging to the dtype of the 
array that is meaningless in the context of my data. For example, if it 
is only composed of positive integers, then I can fill the missing 
values with -1. But in my case, I would like to write a string (empty 
string, actually) to the output file where values are missing. I can't 
do that with the ma.filled(value) method if my masked array dtype is an 
integer.

What I would need is an equivalent of the genfromtxt function for writing.

guillaume

Le 07/09/2010 01:34, Pinner, Luke a écrit :
> How about the masked aray filled method?
> eg numpy.savetxt(somefilename, somemaskedarray.filled(somevalue))
>
> Luke
>
> -----Original Message-----
> From: Guillaume Chérel
> Sent: Monday, 6 September 2010 10:36 PM
> To: Discussion of Numerical Python
> Subject: [Numpy-discussion] saving masked array to a text file
>
>
>    Hello,
> Is there a function like savetxt that can deal with missing values in
> masked arrays? I'd like to control the way the missing values are
> written to the file.
> Thanks,
> Guillaume
>
>
> ------
> If you have received this transmission in error please notify us immediately by return e-mail and delete all copies. If this e-mail or any attachments have been sent to you in error, that error does not constitute waiver of any confidentiality, privilege or copyright in respect of information in the e-mail or attachments.
>
>
>
> Please consider the environment before printing this email.
>
> ------
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list