From d3691eaca589f8055a717e5e9f9b143450bbf79c Mon Sep 17 00:00:00 2001 From: Tushar Mittal Date: Sun, 11 Mar 2018 16:10:34 +0530 Subject: [PATCH 1/2] Update the Period.dayofyear docstring Signed-off-by: Tushar Mittal --- pandas/_libs/tslibs/period.pyx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 89f38724cde1a..9e7b4a13cf76a 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1255,6 +1255,36 @@ cdef class _Period(object): @property def dayofyear(self): + """ + Return the day of the year. + + This attribute returns the day of the year on which the particular + date occurs. The return value ranges between 1 to 365 for regular + years and 1 to 366 for leap years. + + Returns + ------- + int + The day of year. + + See Also + -------- + Period.dayofweek : Return the day of week. + Period.daysinmonth : Return the days in that month. + PeriodIndex.dayofyear : Return the day of year of all indexes. + + Examples + -------- + >>> period = pd.Period("2015-10-23", freq='H') + >>> period.dayofyear + 296 + >>> period = pd.Period("2012-12-31", freq='D') + >>> period.dayofyear + 366 + >>> period = pd.Period("2013-01-01", freq='D') + >>> period.dayofyear + 1 + """ base, mult = get_freq_code(self.freq) return pday_of_year(self.ordinal, base) From 6ff8d46e22757840745990245f6d58dceb13ddda Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 13 Mar 2018 09:48:44 +0100 Subject: [PATCH 2/2] see also to .day --- 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 9e7b4a13cf76a..e14efaf04bd41 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1269,8 +1269,8 @@ cdef class _Period(object): See Also -------- + Period.day : Return the day of the month. Period.dayofweek : Return the day of week. - Period.daysinmonth : Return the days in that month. PeriodIndex.dayofyear : Return the day of year of all indexes. Examples