From eef375c54d641b555c2dca659150eafb86de5975 Mon Sep 17 00:00:00 2001 From: Hammad Mashkoor Date: Sun, 11 Mar 2018 16:43:56 +0530 Subject: [PATCH 1/8] Added Doctring for Period dayofweek --- pandas/_libs/tslibs/period.pyx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 89f38724cde1a..0706669282e14 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1246,6 +1246,37 @@ cdef class _Period(object): @property def dayofweek(self): + """ + Return the day of the week. + + This attribute returns the day of the week on which the particular + date occurs with Monady=0, Sunday=6. + + Returns + ------- + Int:Range of 0 to 6 + + See also + -------- + Period.dayofyear + Return the day of year. + Period.daysinmonth + Return the days in that month. + + Examples + -------- + >>> p=pd.Period('2012-1-1 19:00', freq='H') + >>> p + Period('2012-01-01 19:00', 'H') + >>> p.dayofweek + 6 + + >>> q=pd.Period('2013-1-9 11:00', freq='H') + >>> q + Period('2013-01-09 11:00', 'H') + >>> q.dayofweek + 2 + """ base, mult = get_freq_code(self.freq) return pweekday(self.ordinal, base) From 952be06adbded7d718351f2c4474763f251fa38a Mon Sep 17 00:00:00 2001 From: Hammad Mashkoor Date: Sun, 11 Mar 2018 18:45:52 +0530 Subject: [PATCH 2/8] Updated Doctring for Period dayofweek --- pandas/_libs/tslibs/period.pyx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 0706669282e14..7df66ede4342f 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1250,11 +1250,12 @@ cdef class _Period(object): Return the day of the week. This attribute returns the day of the week on which the particular - date occurs with Monady=0, Sunday=6. + starting date for the given period occurs with Monday=0, Sunday=6. Returns ------- - Int:Range of 0 to 6 + Int + Range of 0 to 6 See also -------- @@ -1265,16 +1266,16 @@ cdef class _Period(object): Examples -------- - >>> p=pd.Period('2012-1-1 19:00', freq='H') - >>> p + >>> period1 = pd.Period('2012-1-1 19:00', freq='H') + >>> period1 Period('2012-01-01 19:00', 'H') - >>> p.dayofweek + >>> period1.dayofweek 6 - >>> q=pd.Period('2013-1-9 11:00', freq='H') - >>> q + >>> period2 = pd.Period('2013-1-9 11:00', freq='H') + >>> period2 Period('2013-01-09 11:00', 'H') - >>> q.dayofweek + >>> period2.dayofweek 2 """ base, mult = get_freq_code(self.freq) From 3e25a7e1ca41df6e840b5b8351c489793fbe21e4 Mon Sep 17 00:00:00 2001 From: Hammad Mashkoor Date: Mon, 12 Mar 2018 15:20:45 +0530 Subject: [PATCH 3/8] Updated Doctring for Period dayofweek --- 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 7df66ede4342f..e8f449f391194 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1255,7 +1255,7 @@ cdef class _Period(object): Returns ------- Int - Range of 0 to 6 + Range from 0 to 6(included). See also -------- From 8072b211f402cbccd303b45cd28b8949d301c673 Mon Sep 17 00:00:00 2001 From: Hammad Mashkoor Date: Tue, 13 Mar 2018 14:49:34 +0530 Subject: [PATCH 4/8] Updated Docstring for perioddayofweek --- pandas/_libs/tslibs/period.pyx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index e8f449f391194..803bc78ea75ff 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1250,19 +1250,18 @@ cdef class _Period(object): Return the day of the week. This attribute returns the day of the week on which the particular - starting date for the given period occurs with Monday=0, Sunday=6. + date for the given period occurs depending on the frequency with + Monday=0, Sunday=6. Returns ------- Int - Range from 0 to 6(included). + Range from 0 to 6 (included). See also -------- - Period.dayofyear - Return the day of year. - Period.daysinmonth - Return the days in that month. + Period.dayofyear : Return the day of year. + Period.daysinmonth : Return the days in that month. Examples -------- From 61bdbb43bed4462d767fbecab507bc33d3e34150 Mon Sep 17 00:00:00 2001 From: Hammad Mashkoor Date: Tue, 13 Mar 2018 15:00:09 +0530 Subject: [PATCH 5/8] Added Docstring for periodstarttime --- 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 803bc78ea75ff..0648d78409c7a 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1164,6 +1164,36 @@ cdef class _Period(object): @property def start_time(self): + """ + Return the Timestamp. + + This attribute returns the timestamp of the particular + starting date for the given period. + + See also + -------- + Period.dayofyear + Return the day of year. + Period.daysinmonth + Return the days in that month. + Period.dayofweek + Return the day of the week. + + Returns + ------- + Timestamp + + Examples + -------- + >>> period = pd.Period('2012-1-1', freq='D') + >>> period + Period('2012-01-01', 'D') + + >>> period.start_time + Timestamp('2012-01-01 00:00:00') + >>> period.end_time + Timestamp('2012-01-01 23:59:59.999999999') + """ return self.to_timestamp(how='S') @property From 52d1898340b673e54c2a2dc61877ebe2d1a81afd Mon Sep 17 00:00:00 2001 From: Hammad Mashkoor Date: Tue, 13 Mar 2018 15:03:55 +0530 Subject: [PATCH 6/8] Added Docstring for periodstarttime --- pandas/_libs/tslibs/period.pyx | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 0648d78409c7a..7dfe1f36bb1e2 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1276,37 +1276,6 @@ cdef class _Period(object): @property def dayofweek(self): - """ - Return the day of the week. - - This attribute returns the day of the week on which the particular - date for the given period occurs depending on the frequency with - Monday=0, Sunday=6. - - Returns - ------- - Int - Range from 0 to 6 (included). - - See also - -------- - Period.dayofyear : Return the day of year. - Period.daysinmonth : Return the days in that month. - - Examples - -------- - >>> period1 = pd.Period('2012-1-1 19:00', freq='H') - >>> period1 - Period('2012-01-01 19:00', 'H') - >>> period1.dayofweek - 6 - - >>> period2 = pd.Period('2013-1-9 11:00', freq='H') - >>> period2 - Period('2013-01-09 11:00', 'H') - >>> period2.dayofweek - 2 - """ base, mult = get_freq_code(self.freq) return pweekday(self.ordinal, base) From 1a6af04841cd8b5be341b3424aa1fffa3e8a4192 Mon Sep 17 00:00:00 2001 From: Hammad Mashkoor Date: Wed, 14 Mar 2018 11:30:20 +0530 Subject: [PATCH 7/8] Updated Docstring for periodstarttime --- pandas/_libs/tslibs/period.pyx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index f33dcee47042c..3a1ee7a49a92a 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1165,24 +1165,18 @@ cdef class _Period(object): @property def start_time(self): """ - Return the Timestamp. - - This attribute returns the timestamp of the particular - starting date for the given period. - - See also - -------- - Period.dayofyear - Return the day of year. - Period.daysinmonth - Return the days in that month. - Period.dayofweek - Return the day of the week. + Get the Timestamp for the start of the period. Returns ------- Timestamp + See also + -------- + Period.dayofyear : Return the day of year. + Period.daysinmonth : Return the days in that month. + Period.dayofweek : Return the day of the week. + Examples -------- >>> period = pd.Period('2012-1-1', freq='D') From 5ba42a74cbae4b48d30a5d57dd05627e341ae14b Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Wed, 14 Mar 2018 09:36:37 -0500 Subject: [PATCH 8/8] end_time [ci skip] [ci skip] --- pandas/_libs/tslibs/period.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 3a1ee7a49a92a..2baf8c47ad7e3 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1173,6 +1173,7 @@ cdef class _Period(object): See also -------- + Period.end_time : Return the end Timestamp. Period.dayofyear : Return the day of year. Period.daysinmonth : Return the days in that month. Period.dayofweek : Return the day of the week. @@ -1185,6 +1186,7 @@ cdef class _Period(object): >>> period.start_time Timestamp('2012-01-01 00:00:00') + >>> period.end_time Timestamp('2012-01-01 23:59:59.999999999') """