math functions fail confusingly on long integers (and object ...
github.com › numpy › numpyJul 29, 2012 · >>> import numpy as np >>> np.sqrt(np.math.factorial(20)) 1559776268.6284978 >>> np.sqrt(np.math.factorial(21)) AttributeError: 'int' object has no attribute 'sqrt' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: loop of ufunc does not support argument 0 of type int which has no callable sqrt method >>> type(np.math.factorial(20)) <class 'int'> >>> type(np.math.factorial(21)) <class 'int'>
Misleading error message with object dtype · Issue #13666 ...
github.com › numpy › numpyMay 29, 2019 · import numpy as np a = np.array([1,2,3], dtype=object) np.sqrt(a) AttributeError: 'int' object has no attribute 'sqrt' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-3-bf82c876ab7f>", line 3, in <module> np.sqrt(a) TypeError: loop of ufunc does not support argument ...