From 36950249ec1540f6e2c2d18df82871d2e48ff95f Mon Sep 17 00:00:00 2001 From: ankit-dhokariya Date: Fri, 23 Aug 2024 14:38:52 -0700 Subject: [PATCH 1/2] adding docstring for pandas.Timestamp.day property --- ci/code_checks.sh | 1 - pandas/_libs/tslibs/timestamps.pyx | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index e9f4ee1f391a2..0c239d49afd6e 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -179,7 +179,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.TimedeltaIndex.nanoseconds SA01" \ -i "pandas.TimedeltaIndex.seconds SA01" \ -i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \ - -i "pandas.Timestamp.day GL08" \ -i "pandas.Timestamp.fold GL08" \ -i "pandas.Timestamp.hour GL08" \ -i "pandas.Timestamp.max PR02" \ diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 3268207b667f2..dffdac335bb3f 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -961,6 +961,29 @@ cdef class _Timestamp(ABCTimestamp): """ return ((self.month - 1) // 3) + 1 + @property + def day(self) -> bool: + """ + Return the day of the Timestamp. + + Returns + ------- + int + The day of the Timestamp. + + See Also + -------- + Timestamp.week : Return the week number of the year. + Timestamp.weekday : Return the day of the week. + + Examples + -------- + >>> ts = pd.Timestamp("2024-08-31 16:16:30") + >>> ts.day + 31 + """ + return super().day + @property def week(self) -> int: """ From 70abb7694930b69765cd1c548e754010c5fbb517 Mon Sep 17 00:00:00 2001 From: ankit-dhokariya Date: Sat, 24 Aug 2024 13:45:09 -0700 Subject: [PATCH 2/2] fixing type annotation --- pandas/_libs/tslibs/timestamps.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index dffdac335bb3f..a9463ce8ad044 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -962,7 +962,7 @@ cdef class _Timestamp(ABCTimestamp): return ((self.month - 1) // 3) + 1 @property - def day(self) -> bool: + def day(self) -> int: """ Return the day of the Timestamp.