diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 1664e6ebb08d..4f162d5ce39d 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -486,7 +486,10 @@ def asscalar(a): 24 """ - return a.item() + try: + return a.item() + except AttributeError: + return np.asarray(a).item() #-----------------------------------------------------------------------------