Skip to content

Commit 8fb47f2

Browse files
authored
Add note on diff's n differing from pandas (#3822)
* note that n != periods in diff docstring * better wording based on feedback
1 parent b2f06cb commit 8fb47f2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

xarray/core/dataarray.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,6 +2692,12 @@ def diff(self, dim: Hashable, n: int = 1, label: Hashable = "upper") -> "DataArr
26922692
difference : same type as caller
26932693
The n-th order finite difference of this object.
26942694
2695+
.. note::
2696+
2697+
`n` matches numpy's behavior and is different from pandas' first
2698+
argument named `periods`.
2699+
2700+
26952701
Examples
26962702
--------
26972703
>>> arr = xr.DataArray([5, 5, 6, 6], [[1, 2, 3, 4]], ['x'])

xarray/core/dataset.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4879,6 +4879,11 @@ def diff(self, dim, n=1, label="upper"):
48794879
difference : same type as caller
48804880
The n-th order finite difference of this object.
48814881
4882+
.. note::
4883+
4884+
`n` matches numpy's behavior and is different from pandas' first
4885+
argument named `periods`.
4886+
48824887
Examples
48834888
--------
48844889
>>> ds = xr.Dataset({'foo': ('x', [5, 5, 6, 6])})

0 commit comments

Comments
 (0)