<p dir="auto">Observed using numpy-1.11.2: If I create a masked array</p>
<p dir="auto">X = np.ma.array(('a','b','c'), mask=(0,1,0))</p>
<p dir="auto">then invoking X.filled() yields:</p>
<p dir="auto">array(['a', 'N', 'c'],  dtype='|S1')</p>
<p dir="auto">Yet the documentation at <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.default_fill_value.html#numpy.ma.default_fill_value" rel="nofollow">https://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.default_fill_value.html#numpy.ma.default_fill_value</a> suggests that the string filling value should be ‘N/A’. The behaviour is analogous if I create a masked array</p>
<p dir="auto">Y = np.ma.array(('aa','bb','cc'), mask=(0,1,0))</p>
<p dir="auto">Then invoking Y.filled() yields:</p>
<p dir="auto">array(['aa', 'N/', 'cc'], dtype='|S2')</p>
<p dir="auto">This behaviour is especially problematic when the non-masked entries in the array already include the respective strings 'N', 'N/'.</p>
<p dir="auto">For string arrays of type <code class="notranslate">S1</code> or <code class="notranslate">S2</code>, the default fill value in Numpy masked arrays (<code class="notranslate">N/A</code>) is not appropriate:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [1]: from numpy import ma

In [2]: x = ma.array(['a', 'b', 'c'], dtype='S1', mask=[1,0,0])

In [3]: x.filled()
Out[3]: 
array(['N', 'b', 'c'], 
      dtype='|S1')

In [4]: x.get_fill_value()
Out[4]: 'N/A'"><pre class="notranslate"><code class="notranslate">In [1]: from numpy import ma

In [2]: x = ma.array(['a', 'b', 'c'], dtype='S1', mask=[1,0,0])

In [3]: x.filled()
Out[3]: 
array(['N', 'b', 'c'], 
      dtype='|S1')

In [4]: x.get_fill_value()
Out[4]: 'N/A'
</code></pre></div>
<p dir="auto">this causes issues for codes that assume the fill value is present in the filled array and indicated masked values. It's not clear to me what the fill value <em>should</em> be, but I'd just thought I'd raise the question.</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/taldcroft/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/taldcroft">@taldcroft</a></p>