diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index b1da0ca1448..4e80ef222c2 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -2692,6 +2692,12 @@ def diff(self, dim: Hashable, n: int = 1, label: Hashable = "upper") -> "DataArr difference : same type as caller The n-th order finite difference of this object. + .. note:: + + `n` matches numpy's behavior and is different from pandas' first + argument named `periods`. + + Examples -------- >>> arr = xr.DataArray([5, 5, 6, 6], [[1, 2, 3, 4]], ['x']) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 7252dd2f3df..52940e98b27 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -4879,6 +4879,11 @@ def diff(self, dim, n=1, label="upper"): difference : same type as caller The n-th order finite difference of this object. + .. note:: + + `n` matches numpy's behavior and is different from pandas' first + argument named `periods`. + Examples -------- >>> ds = xr.Dataset({'foo': ('x', [5, 5, 6, 6])})