[SciPy-user] Masked array question

Pierre GM pgmdevlist@gmail....
Mon Jun 8 12:56:38 CDT 2009


On Jun 8, 2009, at 1:48 PM, josef.pktd@gmail.com wrote:
>
> A very indirect way, that doesn't look worth the trouble in this  
> case would be
>
>>>> np.mafromtxt(StringIO(','.join(['1','','2'])), delimiter=',')
> masked_array(data = [1.0 -- 2.0],
>             mask = [False  True False],
>       fill_value = 1e+020)
>
>>>> np.genfromtxt(StringIO(','.join(['1','','2'])), delimiter=',')
> array([  1.,  NaN,   2.])
>
> if I understand the new functions correctly.

Well, mafromtxt is a shortcut for genfromtxt that sets the usemask  
keyword to True (it is False by default). If you really want a pure  
ndarray, use ndfromtxt


More information about the SciPy-user mailing list