pyMannKendall

1.4.3 · active · verified Mon Apr 13

pyMannKendall is a Python package providing a comprehensive suite of non-parametric Mann-Kendall family of trend tests. It includes 11 different Mann-Kendall tests and 2 Sen's slope estimator functions, making it suitable for analyzing monotonic trends in time series data without assumptions about data distribution. The library is actively maintained, with version 1.4.3 released in early 2023, and receives regular updates to address bugs and introduce new features.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to perform a basic Mann-Kendall trend test on a NumPy array. The `original_test` function returns a named tuple with various statistics including the trend ('increasing', 'decreasing', or 'no trend'), p-value, Kendall Tau, and Sen's slope.

import numpy as np
import pymannkendall as mk

# Sample time series data
data = np.array([1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5])

# Perform the original Mann-Kendall trend test
result = mk.original_test(data)

print(f"Trend: {result.trend}")
print(f"P-value: {result.p}")
print(f"Kendall Tau: {result.Tau}")
print(f"Slope: {result.slope}")
# Output will indicate if a trend is present, its p-value, Tau, and Sen's slope.

view raw JSON →