Closed
Description
I don't know whether doing this is supposed to be supported, but if it isn't the error message could be improved to alert the user that nanstd
and dtype=object
are incompatible.
Reproducing code example:
import numpy
numpy.nanstd(numpy.array([71, 98.0, 80, 93, 57, 46], dtype=object))
Error message:
Traceback (most recent call last):
File "<input>", line 1, in <module>
numpy.nanstd(numpy.array([71, 98.0, 80, 93, 57, 46], dtype=object))
File "<__array_function__ internals>", line 5, in nanstd
File "/home/domdf/.local/lib/python3.8/site-packages/numpy/lib/nanfunctions.py", line 1664, in nanstd
var = nanvar(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
File "<__array_function__ internals>", line 5, in nanvar
File "/home/domdf/.local/lib/python3.8/site-packages/numpy/lib/nanfunctions.py", line 1548, in nanvar
if var.ndim < cnt.ndim:
AttributeError: 'float' object has no attribute 'ndim'
NumPy/Python version information:
Python 3.8.2
Numpy 1.19.1 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]