From 594860fe2bb205a68ba58a40f90169bef405fa52 Mon Sep 17 00:00:00 2001 From: HimanshuAwasthi95 Date: Tue, 13 Mar 2018 22:01:02 +0530 Subject: [PATCH 1/4] DOC : Update the pandas.Period.week docstring --- pandas/_libs/tslibs/period.pyx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index eda0a8492ad24..65ccef4039c2b 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1305,6 +1305,24 @@ cdef class _Period(object): @property def week(self): + """ + Get the total weeks on the Period falls in. + + Returns + ------- + int + + See Also + -------- + Period.dayofweek : Get the day component of the Period. + Period.weekday : Get the day component of the Period. + + Examples + -------- + >>> p = pd.Period("2018-03-11") + >>> p.week + 10 + """ return self.weekofyear @property From 054416bce8e8065b46aaccf6897222a94a574378 Mon Sep 17 00:00:00 2001 From: HimanshuAwasthi95 Date: Thu, 15 Mar 2018 00:47:14 +0530 Subject: [PATCH 2/4] update with example --- pandas/_libs/tslibs/period.pyx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 65ccef4039c2b..517a269c162a0 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1319,9 +1319,16 @@ cdef class _Period(object): Examples -------- - >>> p = pd.Period("2018-03-11") + >>> p = pd.Period("2018-03-11", "H") >>> p.week 10 + + >>> p = pd.Period("2018-02-01", "D") + >>> p.week + 5 + >>> p = pd.Period("2018-01-06", "D") + >>> p.week + 1 """ return self.weekofyear From bfbbcacd6d7a2c95e0c750bac49dc4c8dcdd632f Mon Sep 17 00:00:00 2001 From: HimanshuAwasthi95 Date: Thu, 15 Mar 2018 00:49:15 +0530 Subject: [PATCH 3/4] update with example --- pandas/_libs/tslibs/period.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 517a269c162a0..b79c3ad3a2252 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1326,6 +1326,7 @@ cdef class _Period(object): >>> p = pd.Period("2018-02-01", "D") >>> p.week 5 + >>> p = pd.Period("2018-01-06", "D") >>> p.week 1 From 52a5b7c9d16558e4053656b0679eaca33395e894 Mon Sep 17 00:00:00 2001 From: HimanshuAwasthi95 Date: Fri, 16 Mar 2018 20:51:02 +0530 Subject: [PATCH 4/4] updated summary --- 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 b79c3ad3a2252..9270b8baece08 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1306,7 +1306,7 @@ cdef class _Period(object): @property def week(self): """ - Get the total weeks on the Period falls in. + Get the week of the year on the given Period. Returns -------