From 5f55b02de6b9e366fd2616d2b7a9601654462990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dea=20Mar=C3=ADa=20L=C3=A9on?= Date: Wed, 17 May 2023 14:35:23 +0200 Subject: [PATCH 1/3] Corrected code_checks.sh --- ci/code_checks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 6436556e0a696..885ba93501878 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -83,6 +83,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.Series.backfill \ pandas.Series.ffill \ pandas.Series.pad \ + pandas.Series.dt.end_time \ pandas.Series.dt.days \ pandas.Series.dt.seconds \ pandas.Series.dt.microseconds \ @@ -169,7 +170,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.Timedelta.to_numpy \ pandas.Timedelta.total_seconds \ pandas.arrays.TimedeltaArray \ - pandas.Period.end_time \ pandas.Period.freqstr \ pandas.Period.is_leap_year \ pandas.Period.month \ From 217a16fcfbad904d4889d33e2de860961f6dfb09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dea=20Mar=C3=ADa=20L=C3=A9on?= Date: Wed, 17 May 2023 15:31:43 +0200 Subject: [PATCH 2/3] Added example for Series.dt.end_time --- ci/code_checks.sh | 1 - pandas/_libs/tslibs/period.pyx | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 885ba93501878..6918da60af52d 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -83,7 +83,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.Series.backfill \ pandas.Series.ffill \ pandas.Series.pad \ - pandas.Series.dt.end_time \ pandas.Series.dt.days \ pandas.Series.dt.seconds \ pandas.Series.dt.microseconds \ diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 1626d1490b440..55b9581ee884a 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1664,8 +1664,25 @@ cdef class PeriodMixin: Examples -------- + For Period: + >>> pd.Period('2020-01', 'D').end_time Timestamp('2020-01-01 23:59:59.999999999') + + For Series: + + >>> period = pd.period_range('2020-1-1 00:00', '2020-3-1 00:00', freq='M') + >>> s = pd.Series(period) + >>> s + 0 2020-01 + 1 2020-02 + 2 2020-03 + dtype: period[M] + >>> s.dt.end_time + 0 2020-01-31 23:59:59.999999999 + 1 2020-02-29 23:59:59.999999999 + 2 2020-03-31 23:59:59.999999999 + dtype: datetime64[ns] """ return self.to_timestamp(how="end") From 98c2816ad17606931c9c472ebe398bac923146be Mon Sep 17 00:00:00 2001 From: Marco Edward Gorelli Date: Wed, 17 May 2023 15:13:26 +0100 Subject: [PATCH 3/3] Update pandas/_libs/tslibs/period.pyx --- pandas/_libs/tslibs/period.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 55b9581ee884a..0c19dc4e2ec0a 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -1671,8 +1671,8 @@ cdef class PeriodMixin: For Series: - >>> period = pd.period_range('2020-1-1 00:00', '2020-3-1 00:00', freq='M') - >>> s = pd.Series(period) + >>> period_index = pd.period_range('2020-1-1 00:00', '2020-3-1 00:00', freq='M') + >>> s = pd.Series(period_index) >>> s 0 2020-01 1 2020-02