From bb296bff7eb264da6574412abcbf2ae9853b6c55 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 10 Oct 2024 14:32:12 +0200 Subject: [PATCH] fixes issue #32 --- pymannkendall/pymannkendall.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pymannkendall/pymannkendall.py b/pymannkendall/pymannkendall.py index e5eeb39..ab04ed1 100644 --- a/pymannkendall/pymannkendall.py +++ b/pymannkendall/pymannkendall.py @@ -57,7 +57,10 @@ def __acf(x, nlags): acov = (np.correlate(y, y, 'full') / d)[n - 1:] - return acov[:nlags+1]/acov[0] + if acov[0] != 0 : + return acov[:nlags+1]/acov[0] + else : + return acov[:nlags+1] # vectorization approach to calculate mk score, S