From d98a98f95a72c1a352faa9098597ab8b6aeca215 Mon Sep 17 00:00:00 2001 From: jackgoldsmith4 Date: Sun, 12 Jun 2022 14:52:04 -0400 Subject: [PATCH 1/2] improve period docs --- pandas/_libs/tslibs/period.pyx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 0c05037097839..e1a52a2c3fa27 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -2483,9 +2483,11 @@ class Period(_Period): Parameters ---------- value : Period or str, default None - The time period represented (e.g., '4Q2005'). + The time period represented (e.g., '4Q2005'). This represents neither + the start or the end of the period, but rather the entire period itself. freq : str, default None - One of pandas period strings or corresponding objects. + One of pandas period strings or corresponding objects. Accepted + strings are listed under "Offset aliases" in the `timeseries` docs. ordinal : int, default None The period offset from the proleptic Gregorian epoch. year : int, default None @@ -2502,6 +2504,12 @@ class Period(_Period): Minute value of the period. second : int, default 0 Second value of the period. + + Examples + -------- + >>> period = pd.Period('2012-1-1', freq='D') + >>> period + Period('2012-01-01', 'D') """ def __new__(cls, value=None, freq=None, ordinal=None, From 77bb42989004ad948b7d9918773848a2fce6d904 Mon Sep 17 00:00:00 2001 From: Jack Goldsmith Date: Mon, 13 Jun 2022 19:52:43 -0400 Subject: [PATCH 2/2] Update pandas/_libs/tslibs/period.pyx Co-authored-by: Matthew Roeschke --- 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 e1a52a2c3fa27..8fccd3541fde1 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -2487,7 +2487,7 @@ class Period(_Period): the start or the end of the period, but rather the entire period itself. freq : str, default None One of pandas period strings or corresponding objects. Accepted - strings are listed under "Offset aliases" in the `timeseries` docs. + strings are listed in the :ref:`offset alias section ` in the user docs. ordinal : int, default None The period offset from the proleptic Gregorian epoch. year : int, default None