pydata / sparse

Sparse multi-dimensional arrays for the PyData ecosystem
https://sparse.pydata.org
BSD 3-Clause "New" or "Revised" License
581 stars 123 forks source link

Fix 1D return dtype in argmax/argmin #704

Closed mtsokol closed 1 month ago

mtsokol commented 1 month ago

Hi @hameerabbasi,

This PR fixes argmin/argmax when input is 1D and result is a fill value. To reproduce:

sparse.argmax(sparse.asarray(np.arange(1), dtype=np.uint8)).dtype  # defaulted to `float64` as `np.array([]).dtype` is `float64`. Now it's `intp`