Skip to content
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

DOC: Enforce Numpy Docstring Validation (Issue #59458) #59622

Merged
merged 4 commits into from
Aug 27, 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
5 changes: 0 additions & 5 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,10 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.TimedeltaIndex.seconds SA01" \
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \
-i "pandas.Timestamp.fold GL08" \
-i "pandas.Timestamp.hour GL08" \
-i "pandas.Timestamp.max PR02" \
-i "pandas.Timestamp.microsecond GL08" \
-i "pandas.Timestamp.min PR02" \
-i "pandas.Timestamp.minute GL08" \
-i "pandas.Timestamp.month GL08" \
-i "pandas.Timestamp.nanosecond GL08" \
-i "pandas.Timestamp.resolution PR02" \
-i "pandas.Timestamp.second GL08" \
-i "pandas.Timestamp.tzinfo GL08" \
-i "pandas.Timestamp.value GL08" \
-i "pandas.Timestamp.year GL08" \
Expand Down
115 changes: 115 additions & 0 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,121 @@ cdef class _Timestamp(ABCTimestamp):
"""
return super().day

@property
def month(self) -> int:
"""
Return the month of the Timestamp.

Returns
-------
int
The month of the Timestamp.

See Also
--------
Timestamp.day : Return the day of the year.
Timestamp.year : Return the year of the week.

Examples
--------
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
>>> ts.month
8
"""
return super().month

@property
def hour(self) -> int:
"""
Return the hour of the Timestamp.

Returns
-------
int
The hour of the Timestamp.

See Also
--------
Timestamp.minute : Return the minute of the Timestamp.
Timestamp.second : Return the second of the Timestamp.

Examples
--------
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
>>> ts.hour
16
"""
return super().hour

@property
def minute(self) -> int:
"""
Return the minute of the Timestamp.

Returns
-------
int
The minute of the Timestamp.

See Also
--------
Timestamp.hour : Return the hour of the Timestamp.
Timestamp.second : Return the second of the Timestamp.

Examples
--------
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
>>> ts.minute
16
"""
return super().minute

@property
def second(self) -> int:
"""
Return the second of the Timestamp.

Returns
-------
int
The second of the Timestamp.

See Also
--------
Timestamp.microsecond : Return the microsecond of the Timestamp.
Timestamp.minute : Return the minute of the Timestamp.

Examples
--------
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
>>> ts.second
30
"""
return super().second

@property
def microsecond(self) -> int:
"""
Return the microsecond of the Timestamp.

Returns
-------
int
The microsecond of the Timestamp.

See Also
--------
Timestamp.second : Return the second of the Timestamp.
Timestamp.minute : Return the minute of the Timestamp.

Examples
--------
>>> ts = pd.Timestamp("2024-08-31 16:16:30.2304")
>>> ts.microsecond
230400
"""
return super().microsecond

@property
def week(self) -> int:
"""
Expand Down