Skip to content

Commit

Permalink
DOC: Fix SA01 ES01 for pandas.Timestamp.round (#58700)
Browse files Browse the repository at this point in the history
* DOC: add SA01,ES01 for pandas.Timestamp.round

* DOC: remove SA01,ES01 for pandas.Timestamp.round

* DOC: change docstring in sync with pandas.Timestamp.round
  • Loading branch information
tuhinsharma121 committed May 14, 2024
1 parent e9a2e66 commit daa6adf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,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" \
Expand Down
14 changes: 14 additions & 0 deletions pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,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
Expand Down Expand Up @@ -1004,6 +1010,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
Expand Down
14 changes: 14 additions & 0 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,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
Expand Down Expand Up @@ -2072,6 +2078,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
Expand Down

0 comments on commit daa6adf

Please sign in to comment.