Skip to content

DOC: Fix SA01 ES01 for pandas.Timestamp.round #58700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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
Expand Down Expand Up @@ -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
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 @@ -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
Expand Down Expand Up @@ -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
Expand Down