I have a masked array in numpy:
masked = np.ma.core.MaskedArray([1, 2], mask=[True, False])
Now I want to display the numbers in a plot, so I need formatting:
"{:.2f}".format(masked[0])
'0.00'
"{:.2f}".format(masked[1])
'2.00'
Why is a masked element formatted as '0.00' and how can I avoid this, e.g. by formatting the masked element to NaN or some arbitrary character?