From dd72374fa33859ca9372c366f44e2e097c4fe9e8 Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Wed, 24 Apr 2024 12:52:12 -0400 Subject: [PATCH 1/3] DOC: fix SA01 error for DatetimeIndex: day_of_year, is_leap_year, inferred_freq --- ci/code_checks.sh | 3 --- pandas/core/arrays/datetimelike.py | 5 +++++ pandas/core/arrays/datetimes.py | 10 ++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 101d650a0e768..1327a2e4a1712 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -102,13 +102,10 @@ 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.day_of_year SA01" \ -i "pandas.DatetimeIndex.dayofyear SA01" \ -i "pandas.DatetimeIndex.freqstr SA01" \ -i "pandas.DatetimeIndex.indexer_at_time PR01,RT03" \ -i "pandas.DatetimeIndex.indexer_between_time RT03" \ - -i "pandas.DatetimeIndex.inferred_freq SA01" \ - -i "pandas.DatetimeIndex.is_leap_year SA01" \ -i "pandas.DatetimeIndex.snap PR01,RT03" \ -i "pandas.DatetimeIndex.std PR01,RT03" \ -i "pandas.DatetimeIndex.to_period RT03" \ diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index 974289160b145..ff8b16b3361ee 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -908,6 +908,11 @@ def inferred_freq(self) -> str | None: Returns None if it can't autodetect the frequency. + See Also + -------- + DatetimeIndex.freqstr : Return the frequency object as a string if it's set, + otherwise None. + Examples -------- For DatetimeIndex: diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index be087e19ce7b6..340e52e11c0c8 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -1835,6 +1835,11 @@ def isocalendar(self) -> DataFrame: """ The ordinal day of the year. + See Also + -------- + DatetimeIndex.dayofweek : The day of the week with Monday=0, Sunday=6. + DatetimeIndex.day : The day of the datetime. + Examples -------- For Series: @@ -2155,6 +2160,11 @@ def isocalendar(self) -> DataFrame: Series or ndarray Booleans indicating if dates belong to a leap year. + See Also + -------- + DatetimeIndex.is_year_end : Indicate whether the date is the last day of the year. + DatetimeIndex.is_year_start : Indicate whether the date is the first day of a year. + Examples -------- This method is available on Series with datetime values under From af64380b40321603c3ece956bd79f3b881925791 Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Wed, 24 Apr 2024 13:01:42 -0400 Subject: [PATCH 2/3] fixing line to long error --- pandas/core/arrays/datetimes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 340e52e11c0c8..25c7f926d19a8 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -2162,8 +2162,10 @@ def isocalendar(self) -> DataFrame: See Also -------- - DatetimeIndex.is_year_end : Indicate whether the date is the last day of the year. - DatetimeIndex.is_year_start : Indicate whether the date is the first day of a year. + DatetimeIndex.is_year_end : Indicate whether the date is the + last day of the year. + DatetimeIndex.is_year_start : Indicate whether the date is the first + day of a year. Examples -------- From 919a068d6bf3a457642bfa6ac95644662891491a Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Wed, 24 Apr 2024 14:31:43 -0400 Subject: [PATCH 3/3] Fixing: EXPECTED TO FAIL, BUT NOT FAILING errors --- ci/code_checks.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 1327a2e4a1712..7c97408cee559 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -102,7 +102,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.dayofyear SA01" \ -i "pandas.DatetimeIndex.freqstr SA01" \ -i "pandas.DatetimeIndex.indexer_at_time PR01,RT03" \ -i "pandas.DatetimeIndex.indexer_between_time RT03" \ @@ -261,14 +260,11 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.dt.ceil PR01,PR02" \ -i "pandas.Series.dt.components SA01" \ -i "pandas.Series.dt.day_name PR01,PR02" \ - -i "pandas.Series.dt.day_of_year SA01" \ - -i "pandas.Series.dt.dayofyear SA01" \ -i "pandas.Series.dt.days SA01" \ -i "pandas.Series.dt.days_in_month SA01" \ -i "pandas.Series.dt.daysinmonth SA01" \ -i "pandas.Series.dt.floor PR01,PR02" \ -i "pandas.Series.dt.freq GL08" \ - -i "pandas.Series.dt.is_leap_year SA01" \ -i "pandas.Series.dt.microseconds SA01" \ -i "pandas.Series.dt.month_name PR01,PR02" \ -i "pandas.Series.dt.nanoseconds SA01" \ @@ -397,7 +393,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.TimedeltaIndex.as_unit RT03,SA01" \ -i "pandas.TimedeltaIndex.components SA01" \ -i "pandas.TimedeltaIndex.days SA01" \ - -i "pandas.TimedeltaIndex.inferred_freq SA01" \ -i "pandas.TimedeltaIndex.microseconds SA01" \ -i "pandas.TimedeltaIndex.nanoseconds SA01" \ -i "pandas.TimedeltaIndex.seconds SA01" \