From 02c77205baf8ea8708be6869334faf583d3f5f50 Mon Sep 17 00:00:00 2001 From: Sparkle Russell-Puleri Date: Tue, 20 Aug 2019 12:09:02 -0700 Subject: [PATCH 1/8] Add punctuation to IntervalArray docstrings --- pandas/core/arrays/interval.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pandas/core/arrays/interval.py b/pandas/core/arrays/interval.py index 9cb2721b33634..7a14d6f1b619a 100644 --- a/pandas/core/arrays/interval.py +++ b/pandas/core/arrays/interval.py @@ -361,7 +361,7 @@ def from_arrays(cls, left, right, closed="right", copy=False, dtype=None): _interval_shared_docs[ "from_tuples" ] = """ - Construct an %(klass)s from an array-like of tuples + Construct an %(klass)s from an array-like of tuples. Parameters ---------- @@ -854,7 +854,7 @@ def _format_space(self): def left(self): """ Return the left endpoints of each Interval in the IntervalArray as - an Index + an Index. """ return self._left @@ -862,7 +862,7 @@ def left(self): def right(self): """ Return the right endpoints of each Interval in the IntervalArray as - an Index + an Index. """ return self._right @@ -870,7 +870,7 @@ def right(self): def closed(self): """ Whether the intervals are closed on the left-side, right-side, both or - neither + neither. """ return self._closed @@ -878,7 +878,7 @@ def closed(self): "set_closed" ] = """ Return an %(klass)s identical to the current one, but closed on the - specified side + specified side. .. versionadded:: 0.24.0 @@ -917,7 +917,7 @@ def set_closed(self, closed): def length(self): """ Return an Index with entries denoting the length of each Interval in - the IntervalArray + the IntervalArray. """ try: return self.right - self.left @@ -945,7 +945,7 @@ def mid(self): ] = """ Return True if the %(klass)s is non-overlapping (no Intervals share points) and is either monotonic increasing or monotonic decreasing, - else False + else False. """ # https://github.com/python/mypy/issues/1362 # Mypy does not support decorated properties @@ -995,7 +995,7 @@ def __array__(self, dtype=None): _interval_shared_docs[ "to_tuples" ] = """ - Return an %(return_type)s of tuples of the form (left, right) + Return an %(return_type)s of tuples of the form (left, right). Parameters ---------- From 6f5cc3f5945023c9fe3734c3688061fb561297cc Mon Sep 17 00:00:00 2001 From: Sparkle Russell-Puleri Date: Tue, 20 Aug 2019 17:01:36 -0700 Subject: [PATCH 2/8] Revert "Add punctuation to IntervalArray docstrings" This reverts commit 02c77205baf8ea8708be6869334faf583d3f5f50. --- pandas/core/arrays/interval.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pandas/core/arrays/interval.py b/pandas/core/arrays/interval.py index 7a14d6f1b619a..9cb2721b33634 100644 --- a/pandas/core/arrays/interval.py +++ b/pandas/core/arrays/interval.py @@ -361,7 +361,7 @@ def from_arrays(cls, left, right, closed="right", copy=False, dtype=None): _interval_shared_docs[ "from_tuples" ] = """ - Construct an %(klass)s from an array-like of tuples. + Construct an %(klass)s from an array-like of tuples Parameters ---------- @@ -854,7 +854,7 @@ def _format_space(self): def left(self): """ Return the left endpoints of each Interval in the IntervalArray as - an Index. + an Index """ return self._left @@ -862,7 +862,7 @@ def left(self): def right(self): """ Return the right endpoints of each Interval in the IntervalArray as - an Index. + an Index """ return self._right @@ -870,7 +870,7 @@ def right(self): def closed(self): """ Whether the intervals are closed on the left-side, right-side, both or - neither. + neither """ return self._closed @@ -878,7 +878,7 @@ def closed(self): "set_closed" ] = """ Return an %(klass)s identical to the current one, but closed on the - specified side. + specified side .. versionadded:: 0.24.0 @@ -917,7 +917,7 @@ def set_closed(self, closed): def length(self): """ Return an Index with entries denoting the length of each Interval in - the IntervalArray. + the IntervalArray """ try: return self.right - self.left @@ -945,7 +945,7 @@ def mid(self): ] = """ Return True if the %(klass)s is non-overlapping (no Intervals share points) and is either monotonic increasing or monotonic decreasing, - else False. + else False """ # https://github.com/python/mypy/issues/1362 # Mypy does not support decorated properties @@ -995,7 +995,7 @@ def __array__(self, dtype=None): _interval_shared_docs[ "to_tuples" ] = """ - Return an %(return_type)s of tuples of the form (left, right). + Return an %(return_type)s of tuples of the form (left, right) Parameters ---------- From e9dd48347d80ca3dcb349efc24131dd4a1bc7f09 Mon Sep 17 00:00:00 2001 From: Sparkle Russell-Puleri Date: Tue, 20 Aug 2019 22:12:12 -0700 Subject: [PATCH 3/8] Add punctuation to Timestamp and Timedelta docstring --- pandas/_libs/tslibs/timedeltas.pyx | 8 ++++---- pandas/_libs/tslibs/timestamps.pyx | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index d24aafae0967d..23136919b7299 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1150,7 +1150,7 @@ cdef class _Timedelta(timedelta): """ Format Timedelta as ISO 8601 Duration like ``P[n]Y[n]M[n]DT[n]H[n]M[n]S``, where the ``[n]`` s are replaced by the - values. See https://en.wikipedia.org/wiki/ISO_8601#Durations + values. See https://en.wikipedia.org/wiki/ISO_8601#Durations. .. versionadded:: 0.20.0 @@ -1314,7 +1314,7 @@ class Timedelta(_Timedelta): def round(self, freq): """ - Round the Timedelta to the specified resolution + Round the Timedelta to the specified resolution. Parameters ---------- @@ -1332,7 +1332,7 @@ class Timedelta(_Timedelta): def floor(self, freq): """ - return a new Timedelta floored to this resolution + Return a new Timedelta floored to this resolution. Parameters ---------- @@ -1342,7 +1342,7 @@ class Timedelta(_Timedelta): def ceil(self, freq): """ - return a new Timedelta ceiled to this resolution + Return a new Timedelta ceiled to this resolution. Parameters ---------- diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index c8c6efda30fae..d8b3f7951ebb1 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -246,7 +246,7 @@ class Timestamp(_Timestamp): Timestamp.fromordinal(ordinal, freq=None, tz=None) passed an ordinal, translate and convert to a ts - note: by definition there cannot be any tz info on the ordinal itself + note: by definition there cannot be any tz info on the ordinal itself. Parameters ---------- @@ -336,7 +336,7 @@ class Timestamp(_Timestamp): """ Timestamp.combine(date, time) - date, time -> datetime with same date and time fields + date, time -> datetime with same date and time fields. """ return cls(datetime.combine(date, time)) @@ -441,7 +441,7 @@ class Timestamp(_Timestamp): def round(self, freq, ambiguous='raise', nonexistent='raise'): """ - Round the Timestamp to the specified resolution + Round the Timestamp to the specified resolution. Parameters ---------- @@ -483,7 +483,7 @@ default 'raise' def floor(self, freq, ambiguous='raise', nonexistent='raise'): """ - return a new Timestamp floored to this resolution + Return a new Timestamp floored to this resolution. Parameters ---------- @@ -519,7 +519,7 @@ default 'raise' def ceil(self, freq, ambiguous='raise', nonexistent='raise'): """ - return a new Timestamp ceiled to this resolution + Return a new Timestamp ceiled to this resolution. Parameters ---------- @@ -556,7 +556,7 @@ default 'raise' @property def tz(self): """ - Alias for tzinfo + Alias for tzinfo. """ return self.tzinfo @@ -754,7 +754,7 @@ default 'raise' def resolution(self): """ Return resolution describing the smallest difference between two - times that can be represented by Timestamp object_state + times that can be represented by Timestamp object_state. """ # GH#21336, GH#21365 return Timedelta(nanoseconds=1) @@ -893,7 +893,7 @@ default 'raise' hour=None, minute=None, second=None, microsecond=None, nanosecond=None, tzinfo=object, fold=0): """ - implements datetime.replace, handles nanoseconds + Implements datetime.replace, handles nanoseconds. Parameters ---------- @@ -910,7 +910,7 @@ default 'raise' Returns ------- - Timestamp with fields replaced + Timestamp with fields replaced. """ cdef: From 150181868b5a4eebfee890ec70fc9cbe013c517f Mon Sep 17 00:00:00 2001 From: Sparkle Russell-Puleri Date: Fri, 30 Aug 2019 22:13:02 -0700 Subject: [PATCH 4/8] add punctuation to docstrings --- pandas/_libs/tslibs/timestamps.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index d8b3f7951ebb1..d172eea1b9ffb 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -246,7 +246,7 @@ class Timestamp(_Timestamp): Timestamp.fromordinal(ordinal, freq=None, tz=None) passed an ordinal, translate and convert to a ts - note: by definition there cannot be any tz info on the ordinal itself. + note: by definition there cannot be any tz info on the ordinal itself Parameters ---------- @@ -336,7 +336,7 @@ class Timestamp(_Timestamp): """ Timestamp.combine(date, time) - date, time -> datetime with same date and time fields. + date, time -> datetime with same date and time fields """ return cls(datetime.combine(date, time)) From 968b59faa772c1c819d73bd9ffe9ac944a22f54a Mon Sep 17 00:00:00 2001 From: Sparkle Russell-Puleri Date: Fri, 30 Aug 2019 23:26:48 -0700 Subject: [PATCH 5/8] fix errors in test_nat docstrings --- pandas/_libs/tslibs/timedeltas.pyx | 4 ++-- pandas/_libs/tslibs/timestamps.pyx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 23136919b7299..52911f9fbcccd 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1332,7 +1332,7 @@ class Timedelta(_Timedelta): def floor(self, freq): """ - Return a new Timedelta floored to this resolution. + return a new Timedelta floored to this resolution. Parameters ---------- @@ -1342,7 +1342,7 @@ class Timedelta(_Timedelta): def ceil(self, freq): """ - Return a new Timedelta ceiled to this resolution. + return a new Timedelta ceiled to this resolution. Parameters ---------- diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index d172eea1b9ffb..8687c387c7e18 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -483,7 +483,7 @@ default 'raise' def floor(self, freq, ambiguous='raise', nonexistent='raise'): """ - Return a new Timestamp floored to this resolution. + return a new Timestamp floored to this resolution. Parameters ---------- @@ -519,7 +519,7 @@ default 'raise' def ceil(self, freq, ambiguous='raise', nonexistent='raise'): """ - Return a new Timestamp ceiled to this resolution. + return a new Timestamp ceiled to this resolution. Parameters ---------- @@ -893,7 +893,7 @@ default 'raise' hour=None, minute=None, second=None, microsecond=None, nanosecond=None, tzinfo=object, fold=0): """ - Implements datetime.replace, handles nanoseconds. + implements datetime.replace, handles nanoseconds. Parameters ---------- From 6c023b0710cbae5746656cfa884dfa0cb4f1ef8b Mon Sep 17 00:00:00 2001 From: Sparkle Russell-Puleri Date: Fri, 27 Sep 2019 21:34:32 -0700 Subject: [PATCH 6/8] add period to nattype round docstring --- pandas/_libs/tslibs/nattype.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/nattype.pyx b/pandas/_libs/tslibs/nattype.pyx index 020d1acf0b4ce..e7dce0a33937e 100644 --- a/pandas/_libs/tslibs/nattype.pyx +++ b/pandas/_libs/tslibs/nattype.pyx @@ -545,7 +545,7 @@ class NaTType(_NaT): """) round = _make_nat_func('round', # noqa:E128 """ - Round the Timestamp to the specified resolution + Round the Timestamp to the specified resolution. Parameters ---------- From 212c91909ce29cb87ec912ee5c71e5d1593874ab Mon Sep 17 00:00:00 2001 From: Sparkle Russell-Puleri Date: Fri, 27 Sep 2019 22:19:28 -0700 Subject: [PATCH 7/8] add periods to NaT methods that overlapped with Timestamp --- pandas/_libs/tslibs/nattype.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/_libs/tslibs/nattype.pyx b/pandas/_libs/tslibs/nattype.pyx index e7dce0a33937e..9306338029b73 100644 --- a/pandas/_libs/tslibs/nattype.pyx +++ b/pandas/_libs/tslibs/nattype.pyx @@ -583,7 +583,7 @@ default 'raise' """) floor = _make_nat_func('floor', # noqa:E128 """ - return a new Timestamp floored to this resolution + return a new Timestamp floored to this resolution. Parameters ---------- @@ -617,7 +617,7 @@ default 'raise' """) ceil = _make_nat_func('ceil', # noqa:E128 """ - return a new Timestamp ceiled to this resolution + return a new Timestamp ceiled to this resolution. Parameters ---------- @@ -729,7 +729,7 @@ default 'raise' """) replace = _make_nat_func('replace', # noqa:E128 """ - implements datetime.replace, handles nanoseconds + implements datetime.replace, handles nanoseconds. Parameters ---------- From a9832cbf3b1ba2e7488cefb7885de877ef25d2e2 Mon Sep 17 00:00:00 2001 From: Sparkle Russell-Puleri Date: Fri, 27 Sep 2019 23:11:26 -0700 Subject: [PATCH 8/8] remove extra period in Timestamp.replace return docstring --- pandas/_libs/tslibs/timestamps.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 8687c387c7e18..6ca39d83afd25 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -910,7 +910,7 @@ default 'raise' Returns ------- - Timestamp with fields replaced. + Timestamp with fields replaced """ cdef: