BUG: numpy.concatenate casts a list of integers to floats if concatenated with the empty list (it shouldn't do this)
Open
Nobody has claimed this yet.
00 - Bug
- Dominant language
- Python
- Stars
- 32.8k
- Forks
- 12.8k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 197
Description
Describe the issue:
numpy.concatenate casts a list of integers to floats if concatenated with the empty list
Reproduce the code example:
>>> import numpy as np
>>> np.__version__
'1.20.3'
>>> np.concatenate([[1,2],[1]]) # Good result
array([1, 2, 1])
>>> np.concatenate([[1,2],[]]) # Bad result (should not cast to float!)
array([1., 2.])
Error message:
No response
NumPy/Python version information:
1.20.3 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
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 running the reported np.concatenate examples with NumPy 1.20.3 and trace the concatenate entry point to identify where the empty list affects dtype selection. Done means concatenating integer arrays or lists with an empty list preserves an integer dtype, with regression coverage for both examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100