Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
5 changes: 5 additions & 0 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])})
Expand Down