BUG/API: np.array([0, max_uint64]) has float64 dtype
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 32.8k
- Forks
- 12.8k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 197
Description
I expected to get uint64
umax = np.iinfo(np.uint64).max
np.array([umax]).dtype # <-- uint64, as expected
np.array([0, umax]).dtype # <-- float64, surprising
There seems to be something special going on inference-wise around the int64 bound:
imax = np.iinfo(np.int64).max
np.array([imax, umax]).dtype # <-- float64
np.array([imax+1, umax]).dtype # <-- uint64
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 two np.array reproductions in the issue and inspect NumPy's dtype inference entry point for mixed Python integers. Compare the results around the int64 boundary, then add or update regression coverage so [0, np.iinfo(np.uint64).max] and the other shown cases produce the intended dtype.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100