Skip to content

Commit becca30

Browse files
adding docstring for Timestamp properties
1 parent 360597c commit becca30

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,122 @@ cdef class _Timestamp(ABCTimestamp):
984984
"""
985985
return super().day
986986
987+
@property
988+
def month(self) -> int:
989+
"""
990+
Return the month of the Timestamp.
991+
992+
Returns
993+
-------
994+
int
995+
The month of the Timestamp.
996+
997+
See Also
998+
--------
999+
Timestamp.day : Return the day of the year.
1000+
Timestamp.year : Return the year of the week.
1001+
1002+
Examples
1003+
--------
1004+
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
1005+
>>> ts.month
1006+
8
1007+
"""
1008+
return super().month
1009+
1010+
@property
1011+
def hour(self) -> int:
1012+
"""
1013+
Return the hour of the Timestamp.
1014+
1015+
Returns
1016+
-------
1017+
int
1018+
The hour of the Timestamp.
1019+
1020+
See Also
1021+
--------
1022+
Timestamp.minute : Return the minute of the Timestamp.
1023+
Timestamp.second : Return the second of the Timestamp.
1024+
1025+
Examples
1026+
1027+
--------
1028+
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
1029+
>>> ts.hour
1030+
16
1031+
"""
1032+
return super().hour
1033+
1034+
@property
1035+
def minute(self) -> int:
1036+
"""
1037+
Return the minute of the Timestamp.
1038+
1039+
Returns
1040+
-------
1041+
int
1042+
The minute of the Timestamp.
1043+
1044+
See Also
1045+
--------
1046+
Timestamp.hour : Return the hour of the Timestamp.
1047+
Timestamp.second : Return the second of the Timestamp.
1048+
1049+
Examples
1050+
--------
1051+
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
1052+
>>> ts.minute
1053+
16
1054+
"""
1055+
return super().minute
1056+
1057+
@property
1058+
def second(self) -> int:
1059+
"""
1060+
Return the second of the Timestamp.
1061+
1062+
Returns
1063+
-------
1064+
int
1065+
The second of the Timestamp.
1066+
1067+
See Also
1068+
--------
1069+
Timestamp.microsecond : Return the microsecond of the Timestamp.
1070+
Timestamp.minute : Return the minute of the Timestamp.
1071+
1072+
Examples
1073+
--------
1074+
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
1075+
>>> ts.second
1076+
30
1077+
"""
1078+
return super().second
1079+
1080+
@property
1081+
def microsecond(self) -> int:
1082+
"""
1083+
Return the microsecond of the Timestamp.
1084+
1085+
Returns
1086+
-------
1087+
int
1088+
The microsecond of the Timestamp.
1089+
1090+
See Also
1091+
--------
1092+
Timestamp.second : Return the second of the Timestamp.
1093+
Timestamp.minute : Return the minute of the Timestamp.
1094+
1095+
Examples
1096+
--------
1097+
>>> ts = pd.Timestamp("2024-08-31 16:16:30.2304")
1098+
>>> ts.microsecond
1099+
230400
1100+
"""
1101+
return super().microsecond
1102+
9871103
@property
9881104
def week(self) -> int:
9891105
"""

0 commit comments

Comments
 (0)