From d1ff4c64b9bfd6826ffb202b6ebe7bef33d412ae Mon Sep 17 00:00:00 2001 From: Andy Terrel Date: Sat, 10 Mar 2018 11:12:55 -0600 Subject: [PATCH 1/3] DOC: Improve the docstring of DataFrame.head() - Improved summary details - Added description of last in see-also --- pandas/core/generic.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 9f2112729a503..fee5bbc631f7c 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -3607,6 +3607,10 @@ def head(self, n=5): """ Return the first n rows. + This function returns rows for the object based on the underlying + index. It is useful for quickly testing if your object has the + right type of data in it. + Parameters ---------- n : int, default 5 @@ -3620,6 +3624,7 @@ def head(self, n=5): See Also -------- pandas.DataFrame.tail + Returns the last n rows. Examples -------- From 7856ad550c8989d269be53d28e3b4979dffcfc8c Mon Sep 17 00:00:00 2001 From: Andy Terrel Date: Sat, 10 Mar 2018 12:30:45 -0600 Subject: [PATCH 2/3] DOC: Improving pandas.DataFrame.head --- pandas/core/generic.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index fee5bbc631f7c..0ff5057eb17e3 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -3607,9 +3607,9 @@ def head(self, n=5): """ Return the first n rows. - This function returns rows for the object based on the underlying - index. It is useful for quickly testing if your object has the - right type of data in it. + This function returns the first n rows for the object based on the + underlying index. It is useful for quickly testing if your object + has the right type of data in it. Parameters ---------- @@ -3623,8 +3623,7 @@ def head(self, n=5): See Also -------- - pandas.DataFrame.tail - Returns the last n rows. + pandas.DataFrame.tail: Returns the last n rows. Examples -------- From cfd3bcf984f956dab2d6a2e1aaccd30cf0897139 Mon Sep 17 00:00:00 2001 From: Andy Terrel Date: Sat, 10 Mar 2018 12:43:07 -0600 Subject: [PATCH 3/3] DOC: Updating pandas.DataFrame.head - backticks around n --- pandas/core/generic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 0ff5057eb17e3..435915ef4d174 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -3605,9 +3605,9 @@ def f(x): def head(self, n=5): """ - Return the first n rows. + Return the first `n` rows. - This function returns the first n rows for the object based on the + This function returns the first `n` rows for the object based on the underlying index. It is useful for quickly testing if your object has the right type of data in it. @@ -3623,7 +3623,7 @@ def head(self, n=5): See Also -------- - pandas.DataFrame.tail: Returns the last n rows. + pandas.DataFrame.tail: Returns the last `n` rows. Examples --------