Skip to content

Commit

Permalink
DOC: Enforce Numpy Docstring Validation - Timestamp.strftime and Time…
Browse files Browse the repository at this point in the history
…stamp.isoformat (#58677)

* DOC: add See also section to Timestamp.strftime and Timestamp.isoformat

* ensure NaT.strftime  docstring matches Timestamp.strftime
  • Loading branch information
abonte committed May 11, 2024
1 parent 3ecf177 commit bfe5a22
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Expand Up @@ -283,7 +283,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.hour GL08" \
-i "pandas.Timestamp.is_leap_year SA01" \
-i "pandas.Timestamp.isocalendar SA01" \
-i "pandas.Timestamp.isoformat SA01" \
-i "pandas.Timestamp.isoweekday SA01" \
-i "pandas.Timestamp.max PR02" \
-i "pandas.Timestamp.microsecond GL08" \
Expand All @@ -299,7 +298,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.resolution PR02,PR07,SA01" \
-i "pandas.Timestamp.round SA01" \
-i "pandas.Timestamp.second GL08" \
-i "pandas.Timestamp.strftime SA01" \
-i "pandas.Timestamp.strptime PR01,SA01" \
-i "pandas.Timestamp.time SA01" \
-i "pandas.Timestamp.timestamp SA01" \
Expand Down
6 changes: 6 additions & 0 deletions pandas/_libs/tslibs/nattype.pyx
Expand Up @@ -692,6 +692,12 @@ class NaTType(_NaT):
See strftime documentation for more information on the format string:
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior.
See Also
--------
Timestamp.isoformat : Return the time formatted according to ISO 8601.
pd.to_datetime : Convert argument to datetime.
Period.strftime : Format a single Period.
Examples
--------
>>> ts = pd.Timestamp('2020-03-14T15:32:52.192548651')
Expand Down
12 changes: 12 additions & 0 deletions pandas/_libs/tslibs/timestamps.pyx
Expand Up @@ -1008,6 +1008,12 @@ cdef class _Timestamp(ABCTimestamp):
-------
str

See Also
--------
Timestamp.strftime : Return a formatted string.
Timestamp.isocalendar : Return a tuple containing ISO year, week number and
weekday.

Examples
--------
>>> ts = pd.Timestamp('2020-03-14T15:32:52.192548651')
Expand Down Expand Up @@ -1549,6 +1555,12 @@ class Timestamp(_Timestamp):
See strftime documentation for more information on the format string:
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior.
See Also
--------
Timestamp.isoformat : Return the time formatted according to ISO 8601.
pd.to_datetime : Convert argument to datetime.
Period.strftime : Format a single Period.
Examples
--------
>>> ts = pd.Timestamp('2020-03-14T15:32:52.192548651')
Expand Down

0 comments on commit bfe5a22

Please sign in to comment.