From 3687ae081ffd6586497eb0d0111a57d54dced0c8 Mon Sep 17 00:00:00 2001 From: hughkelley Date: Tue, 22 Oct 2019 15:04:39 +0100 Subject: [PATCH 1/5] fix formatting and content of pandas.Period docstring. Closes #29073 --- pandas/_libs/tslibs/period.pyx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 84a41b8757001..35896040065b0 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -2385,16 +2385,25 @@ class Period(_Period): Parameters ---------- value : Period or str, default None - The time period represented (e.g., '4Q2005') + The time period represented (e.g., '4Q2005'). freq : str, default None - One of pandas period strings or corresponding objects + One of pandas period strings or corresponding objects. + ordinal : int, default None + The period offset from the gregorian proleptic epoch. year : int, default None + Year value of the period. month : int, default 1 + Month value of the period. quarter : int, default None + Quarter value of the period. day : int, default 1 + Day value of the period. hour : int, default 0 + Hour value of the period. minute : int, default 0 + Minute value of the period. second : int, default 0 + Second value of the period. """ def __new__(cls, value=None, freq=None, ordinal=None, From d15b5e66cedbedabc10f87dff834c90d7dea3231 Mon Sep 17 00:00:00 2001 From: hughkelley Date: Tue, 22 Oct 2019 15:26:27 +0100 Subject: [PATCH 2/5] fix errors in pandas.Period.asfreq --- pandas/_libs/tslibs/period.pyx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 35896040065b0..d0f810a738c2b 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1709,14 +1709,14 @@ cdef class _Period: def asfreq(self, freq, how='E'): """ - Convert Period to desired frequency, either at the start or end of the - interval. + Convert Period to desired frequency, at the start or end of the interval. Parameters ---------- - freq : string + freq : str + The desired frequency. how : {'E', 'S', 'end', 'start'}, default 'end' - Start or end of the timespan + Start or end of the timespan. Returns ------- From abfa2c0dcdf06dd26e74aaf89960086d952e1aae Mon Sep 17 00:00:00 2001 From: hughkelley Date: Tue, 22 Oct 2019 15:46:38 +0100 Subject: [PATCH 3/5] fix content and formatting of pandas.Period.to_timestamp --- pandas/_libs/tslibs/period.pyx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index d0f810a738c2b..902a7ead54e74 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1776,17 +1776,19 @@ cdef class _Period: def to_timestamp(self, freq=None, how='start', tz=None): """ - Return the Timestamp representation of the Period at the target - frequency at the specified end (how) of the Period. + Return the Timestamp representation of the Period. + + Uses the target frequency specified at the part of the period specified + by `how`, which is either `Start` or `Finish`. Parameters ---------- - freq : string or DateOffset + freq : str or DateOffset Target frequency. Default is 'D' if self.freq is week or - longer and 'S' otherwise + longer and 'S' otherwise. how : str, default 'S' (start) - 'S', 'E'. Can be aliased as case insensitive - 'Start', 'Finish', 'Begin', 'End' + One of 'S', 'E'. Can be aliased as case insensitive + 'Start', 'Finish', 'Begin', 'End'. Returns ------- From 2d572be5ef0272f327258591583f38f99e1dabd4 Mon Sep 17 00:00:00 2001 From: hughkelley Date: Tue, 22 Oct 2019 15:52:18 +0100 Subject: [PATCH 4/5] fix formatting error in pandas.PeriodDtype --- pandas/core/dtypes/dtypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/dtypes/dtypes.py b/pandas/core/dtypes/dtypes.py index ae6f2ed289248..95a1d9bb280bd 100644 --- a/pandas/core/dtypes/dtypes.py +++ b/pandas/core/dtypes/dtypes.py @@ -793,7 +793,7 @@ class PeriodDtype(PandasExtensionDtype): Parameters ---------- freq : str or DateOffset - The frequency of this PeriodDtype + The frequency of this PeriodDtype. Attributes ---------- From 70e5b440458706eccfaa31565df07b9b5965b435 Mon Sep 17 00:00:00 2001 From: hughkelley Date: Tue, 22 Oct 2019 20:37:34 +0100 Subject: [PATCH 5/5] fix whitespace --- pandas/_libs/tslibs/period.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 902a7ead54e74..aed64aff14e0a 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1778,7 +1778,7 @@ cdef class _Period: """ Return the Timestamp representation of the Period. - Uses the target frequency specified at the part of the period specified + Uses the target frequency specified at the part of the period specified by `how`, which is either `Start` or `Finish`. Parameters