John, you want c.compressed().

John Hunter wrote:

>I'm a bit of an ma newbie.  I have a 2D masked array R and want to
>extract the non-masked values in the last column.  Below I use logical
>indexing, but I suspect there is a "built-in" way w/ masked arrays.  I
>read through the docstring, but didn't see anything better.
>
>In [66]: c = R[:,-1]
>
>In [67]: m = R.mask[:,-1]
>
>
>In [69]: c[m==0]
>Out[69]:
>array(data =
> [ 0.94202899  0.51839465  0.24080268  0.26198439  0.29877369
> 2.06856187
>  0.91415831  0.64994426  0.96544036  1.11259755  2.53623188
>  0.71571906
>  0.18394649  0.78037904  0.60869565  3.56744705  0.44147157
>  0.07692308
>  0.27090301  0.16610925  0.57068004  0.80267559  0.57636566
>  0.23634337
>  1.9509476   0.50761427  0.09587514  0.45039019  0.14381271
>  0.69007804
>  2.44481605  0.2909699   0.45930881  1.37123746  2.00668896
>  3.1638796
>  1.0735786   1.06800446  0.18952062  1.55964326  1.16833891
>  0.17502787
>  1.16610925  0.85507246  0.42140468  0.04236343  1.01337793
>  0.22853958
>  1.76365663  1.78372352  0.96209588  0.73578595  0.94760312
>  1.59531773
>  0.88963211],
>      mask =
> [False False False False False False False False False False False
> False
> False False False False False False False False False False False
> False
> False False False False False False False False False False False
> False
> False False False False False False False False False False False
> False
> False False False False False False False],
>      fill_value=1e+20)
>
>
>
>
>-------------------------------------------------------
>All the advantages of Linux Managed Hosting--Without the Cost and Risk!
>Fully trained technicians. The highest number of Red Hat certifications in
>the hosting industry. Fanatical Support. Click to learn more
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
>_______________________________________________
>Numpy-discussion mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>  
>



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Numpy-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to