sparse
sparse copied to clipboard
wrong nanmean with complex64
Describe the bug np.nanmean of sparse array does not match numpy result
To Reproduce
import numpy as np
import sparse as sp
array = np.array([0. +0.j, 0.+np.nan * 1j], dtype=np.complex64)
sparray = sp.COO.from_numpy(array)
print("numpy:", np.nanmean(array), "sparse:", np.nanmean(sparray))
numpy: 0j sparse: (nan+nanj)
Expected behavior Match the numpy result
System
- OS and version: [e.g. Windows 10] macOS latest
-
sparse
version (sparse.__version__
) 0.13.0 - NumPy version (
np.__version__
) 1.22.4 - Numba version (
numba.__version__
) 0.55.2
Additional context
Seen when using hypothesis
to test out array wrapping in xarray (https://github.com/pydata/xarray/pull/4972)
Thanks for the report, I'll look into this.
Thanks!