From 212e92dce0f9afe8b911a99cbb1cb174c8674673 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Mon, 13 May 2024 17:50:56 +0530 Subject: [PATCH 1/3] DOC: add SA01,ES01 for pandas.Timestamp.round --- pandas/_libs/tslibs/timestamps.pyx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index bcd758b9a9042..acde61b07c17e 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -2015,6 +2015,12 @@ class Timestamp(_Timestamp): """ Round the Timestamp to the specified resolution. + This method rounds the given Timestamp down to a specified frequency + level. It is particularly useful in data analysis to normalize timestamps + to regular frequency intervals. For instance, rounding to the nearest + minute, hour, or day can help in time series comparisons or resampling + operations. + Parameters ---------- freq : str @@ -2049,6 +2055,14 @@ timedelta}, default 'raise' ------ ValueError if the freq cannot be converted + See Also + -------- + datetime.round : Similar behavior in native Python datetime module. + Timestamp.floor : Round the Timestamp downward to the nearest multiple + of the specified frequency. + Timestamp.ceil : Round the Timestamp upward to the nearest multiple of + the specified frequency. + Notes ----- If the Timestamp has a timezone, rounding will take place relative to the From 6737b19b3c4de06a1462317791549d4363d33ab2 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Mon, 13 May 2024 17:51:47 +0530 Subject: [PATCH 2/3] DOC: remove SA01,ES01 for pandas.Timestamp.round --- ci/code_checks.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 24321f8ef54f7..943a80562b3e3 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -292,7 +292,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Timestamp.quarter SA01" \ -i "pandas.Timestamp.replace PR07,SA01" \ -i "pandas.Timestamp.resolution PR02,PR07,SA01" \ - -i "pandas.Timestamp.round SA01" \ -i "pandas.Timestamp.second GL08" \ -i "pandas.Timestamp.strptime PR01,SA01" \ -i "pandas.Timestamp.time SA01" \ From 72db0789a573a57ab774b1c47f637629e76c0d53 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Tue, 14 May 2024 11:12:48 +0530 Subject: [PATCH 3/3] DOC: change docstring in sync with pandas.Timestamp.round --- pandas/_libs/tslibs/nattype.pyx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pandas/_libs/tslibs/nattype.pyx b/pandas/_libs/tslibs/nattype.pyx index cf7c20d84c2d4..0e1e0873a09b4 100644 --- a/pandas/_libs/tslibs/nattype.pyx +++ b/pandas/_libs/tslibs/nattype.pyx @@ -947,6 +947,12 @@ class NaTType(_NaT): """ Round the Timestamp to the specified resolution. + This method rounds the given Timestamp down to a specified frequency + level. It is particularly useful in data analysis to normalize timestamps + to regular frequency intervals. For instance, rounding to the nearest + minute, hour, or day can help in time series comparisons or resampling + operations. + Parameters ---------- freq : str @@ -981,6 +987,14 @@ timedelta}, default 'raise' ------ ValueError if the freq cannot be converted + See Also + -------- + datetime.round : Similar behavior in native Python datetime module. + Timestamp.floor : Round the Timestamp downward to the nearest multiple + of the specified frequency. + Timestamp.ceil : Round the Timestamp upward to the nearest multiple of + the specified frequency. + Notes ----- If the Timestamp has a timezone, rounding will take place relative to the