Skip to content

Commit 5b61330

Browse files
committed
DOC: update the pandas.DataFrame.diff docstring
2 parents 2e84d6f + c3d491a commit 5b61330

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

pandas/core/generic.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3605,7 +3605,11 @@ def f(x):
36053605

36063606
def head(self, n=5):
36073607
"""
3608-
Return the first n rows.
3608+
Return the first `n` rows.
3609+
3610+
This function returns the first `n` rows for the object based on the
3611+
underlying index. It is useful for quickly testing if your object
3612+
has the right type of data in it.
36093613
36103614
Parameters
36113615
----------
@@ -3619,7 +3623,7 @@ def head(self, n=5):
36193623
36203624
See Also
36213625
--------
3622-
pandas.DataFrame.tail
3626+
pandas.DataFrame.tail: Returns the last `n` rows.
36233627
36243628
Examples
36253629
--------

pandas/core/indexes/base.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,18 +2256,19 @@ def sortlevel(self, level=None, ascending=True, sort_remaining=None):
22562256
return self.sort_values(return_indexer=True, ascending=ascending)
22572257

22582258
def shift(self, periods=1, freq=None):
2259-
"""Shift index by desired number of time frequency increments.
2259+
"""
2260+
Shift index by desired number of time frequency increments.
22602261
22612262
This method is for shifting the values of datetime-like indexes
22622263
by a specified time increment a given number of times.
22632264
22642265
Parameters
22652266
----------
2266-
periods : int
2267+
periods : int, default 1
22672268
Number of periods (or increments) to shift by,
2268-
can be positive or negative (default is 1).
2269-
freq : pandas.DateOffset, pandas.Timedelta or string
2270-
Frequency increment to shift by (default is None).
2269+
can be positive or negative.
2270+
freq : pandas.DateOffset, pandas.Timedelta or string, optional
2271+
Frequency increment to shift by.
22712272
If None, the index is shifted by its own `freq` attribute.
22722273
Offset aliases are valid strings, e.g., 'D', 'W', 'M' etc.
22732274
@@ -2276,6 +2277,10 @@ def shift(self, periods=1, freq=None):
22762277
pandas.Index
22772278
shifted index
22782279
2280+
See Also
2281+
--------
2282+
Series.shift : Shift values of Series.
2283+
22792284
Examples
22802285
--------
22812286
Put the first 5 month starts of 2011 into an index.

0 commit comments

Comments
 (0)