From bfe59fb67c5d1ad2585a65290e5d942a67177f4b Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Mon, 22 Apr 2024 17:13:00 -0400 Subject: [PATCH 1/2] DOC: Fixing SA01 issues for DatetimeIndex: date and tz --- ci/code_checks.sh | 2 -- pandas/core/arrays/datetimes.py | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index a7a4bcf165f2a..464451f2bcd72 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -103,7 +103,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DataFrame.to_markdown SA01" \ -i "pandas.DataFrame.to_parquet RT03" \ -i "pandas.DataFrame.var PR01,RT03,SA01" \ - -i "pandas.DatetimeIndex.date SA01" \ -i "pandas.DatetimeIndex.day_of_year SA01" \ -i "pandas.DatetimeIndex.dayofyear SA01" \ -i "pandas.DatetimeIndex.freqstr SA01" \ @@ -115,7 +114,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DatetimeIndex.std PR01,RT03" \ -i "pandas.DatetimeIndex.to_period RT03" \ -i "pandas.DatetimeIndex.to_pydatetime RT03,SA01" \ - -i "pandas.DatetimeIndex.tz SA01" \ -i "pandas.DatetimeIndex.tz_convert RT03" \ -i "pandas.DatetimeTZDtype SA01" \ -i "pandas.DatetimeTZDtype.tz SA01" \ diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index fb9f047d432a1..203308b4f0dee 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -593,6 +593,13 @@ def tz(self) -> tzinfo | None: datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None Returns None when the array is tz-naive. + See Also + -------- + DatetimeIndex.tz_localize : Localize tz-naive DatetimeIndex to a + given time zone, or remove timezone from a tz-aware DatetimeIndex. + DatetimeIndex.tz_convert : Convert tz-aware DatetimeIndex from + one time zone to another. + Examples -------- For Series: @@ -1476,6 +1483,14 @@ def date(self) -> npt.NDArray[np.object_]: Namely, the date part of Timestamps without time and timezone information. + See Also + -------- + DatetimeIndex.time : Returns numpy array of :class:`datetime.time` objects. + The time part of the Timestamps. + DatetimeIndex.year : The year of the datetime. + DatetimeIndex.month : The month as January=1, December=12. + DatetimeIndex.day : The day of the datetime. + Examples -------- For Series: From 42fd8ac234db2a00c605a3e8b85d1aa190049eb5 Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Mon, 22 Apr 2024 17:42:42 -0400 Subject: [PATCH 2/2] fixing: XPECTED TO FAIL, BUT NOT FAILING error --- ci/code_checks.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 464451f2bcd72..27d54b8b8b855 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -269,7 +269,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.dt.as_unit PR01,PR02" \ -i "pandas.Series.dt.ceil PR01,PR02" \ -i "pandas.Series.dt.components SA01" \ - -i "pandas.Series.dt.date SA01" \ -i "pandas.Series.dt.day_name PR01,PR02" \ -i "pandas.Series.dt.day_of_year SA01" \ -i "pandas.Series.dt.dayofyear SA01" \ @@ -289,7 +288,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.dt.strftime PR01,PR02" \ -i "pandas.Series.dt.to_period PR01,PR02,RT03" \ -i "pandas.Series.dt.total_seconds PR01" \ - -i "pandas.Series.dt.tz SA01" \ -i "pandas.Series.dt.tz_convert PR01,PR02,RT03" \ -i "pandas.Series.dt.tz_localize PR01,PR02" \ -i "pandas.Series.dt.unit GL08" \