From d7de4ad70d6794b36e4789e4f6146a884113bd66 Mon Sep 17 00:00:00 2001 From: ayir Date: Wed, 10 Apr 2019 17:00:25 +0200 Subject: ENH: add clearer error message for diff(0-d) --- numpy/lib/function_base.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index fb40ef927..7a405b382 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1235,6 +1235,8 @@ def diff(a, n=1, axis=-1, prepend=np._NoValue, append=np._NoValue): a = asanyarray(a) nd = a.ndim + if nd == 0: + raise ValueError("diff requires input that is at least one dimensional") axis = normalize_axis_index(axis, nd) combined = [] -- cgit v1.2.1