numpy.ma default fill value for strings not appropriate for S1 and S2
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 32.8k
- Forks
- 12.8k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 197
Description
For string arrays of type S1 or S2, the default fill value in Numpy masked arrays (N/A) is not appropriate:
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'
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 should be, but I'd just thought I'd raise the question.
cc @taldcroft
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the masked-array example with S1 and S2 string dtypes and trace how numpy.ma selects the default fill value. The issue does not identify a file or test; done requires an agreed fill value that remains appropriate for both widths and tests showing masked values are distinguishable after filling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100