From 2e940f0f486556b86a8c443af7aff27dfbea094a Mon Sep 17 00:00:00 2001 From: HimanshuAwasthi95 Date: Mon, 12 Mar 2018 10:51:31 +0530 Subject: [PATCH 1/2] Add docstring for period.day --- pandas/_libs/tslibs/period.pyx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 89f38724cde1a..f4c21584e0cf2 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1217,6 +1217,32 @@ cdef class _Period(object): @property def day(self): + """ + Return the number of days of particular month of a given Period. + + This attribute returns the total number of days of given month on which + the particular date occurs. + + Returns + ------- + Int + Number of days till particular date + + See also + -------- + Period.dayofweek + Return the day of the week + + Period.dayofyear + Return the day of the year + + Examples + -------- + >>> import pandas as pd + >>> p = pd.Period("2018-03-11", freq='H') + >>> p.day + 11 + """ base, mult = get_freq_code(self.freq) return pday(self.ordinal, base) From 85633a91fc7b4ea736eef9f6b3ad9b05a419fe2a Mon Sep 17 00:00:00 2001 From: HimanshuAwasthi95 Date: Mon, 12 Mar 2018 13:33:51 +0530 Subject: [PATCH 2/2] Update changes --- pandas/_libs/tslibs/period.pyx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index f4c21584e0cf2..af4ec4e8a9a66 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1218,27 +1218,20 @@ cdef class _Period(object): @property def day(self): """ - Return the number of days of particular month of a given Period. + Get day of the month that a Period falls on. - This attribute returns the total number of days of given month on which - the particular date occurs. - Returns ------- - Int - Number of days till particular date + int - See also + See Also -------- - Period.dayofweek - Return the day of the week + Period.dayofweek : Get the day of the week - Period.dayofyear - Return the day of the year + Period.dayofyear : Get the day of the year Examples -------- - >>> import pandas as pd >>> p = pd.Period("2018-03-11", freq='H') >>> p.day 11