I'd like to change the symbol representing masked values in printed masked array. What I get is:
>>> print ma.array([[1, 0,0,1],[1,0,1,0]],mask=[[0,0,0,1],[1,1,0,1]])
[[1 0 0 --]
[-- -- 1 --]]
I would prefer:
[[1 0 0 -]
[- - 1 -]]
I've tried to set numpy.ma.masked_print_option
, but it does not work:
>>> numpy.ma.masked_print_options = '-'
>>> print ma.array([[1, 0,0,1],[1,0,1,0]],mask=[[0,0,0,1],[1,1,0,1]])
[[1 0 0 --]
[-- -- 1 --]]
You were close!
In [4]: np.ma.masked_print_option.set_display("-")
In [5]: np.ma.array([[1, 0,0,1],[1,0,1,0]],mask=[[0,0,0,1],[1,1,0,1]])
Out[5]:
masked_array(data =
[[1 0 0 -]
[- - 1 -]],
mask =
[[False False False True]
[ True True False True]],
fill_value = 999999)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With