Skip to content

Commit 887f5fe

Browse files
changes to add min,max and microsec
1 parent ede2e2d commit 887f5fe

File tree

2 files changed

+76
-3
lines changed

2 files changed

+76
-3
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
181181
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \
182182
-i "pandas.Timestamp.day GL08" \
183183
-i "pandas.Timestamp.fold GL08" \
184-
-i "pandas.Timestamp.max PR02" \
185-
-i "pandas.Timestamp.microsecond GL08" \
186-
-i "pandas.Timestamp.min PR02" \
187184
-i "pandas.Timestamp.minute GL08" \
188185
-i "pandas.Timestamp.month GL08" \
189186
-i "pandas.Timestamp.nanosecond GL08" \

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,82 @@ cdef class _Timestamp(ABCTimestamp):
612612
field, freq_name, month_kw, self._creso)
613613
return out[0]
614614

615+
@property
616+
def microsecond(self) -> int:
617+
"""
618+
Return the microsecond component of the Timestamp.
619+
620+
The microsecond component represents the number of microseconds
621+
(0 to 999,999) of the Timestamp.
622+
623+
Returns
624+
-------
625+
int
626+
Microsecond component of the Timestamp, ranging from 0 to 999,999.
627+
628+
See Also
629+
--------
630+
Timestamp.second : Return the second component of the Timestamp.
631+
Timestamp.minute : Return the minute component of the Timestamp.
632+
633+
Examples
634+
--------
635+
>>> ts = pd.Timestamp('2024-08-23 14:30:15.123456')
636+
>>> ts.microsecond
637+
123456
638+
"""
639+
return self.microsecond
640+
641+
def max(self):
642+
"""
643+
A constant that represents the maximum valid date and time value for a
644+
pandas Timestamp object.
645+
646+
This property returns the highest datetime value that can be represented
647+
by a pandas.Timestamp object, which is equivalent to
648+
pd.Timestamp('2262-04-11 23:47:16.854775807').
649+
650+
Returns
651+
-------
652+
Timestamp
653+
The maximum valid datetime value for a Timestamp object.
654+
655+
See Also
656+
--------
657+
Timestamp.min : Return the minimum valid date and time value for
658+
pandas Timestamp object.
659+
660+
Examples
661+
--------
662+
>>> pd.Timestamp.max
663+
Timestamp('2262-04-11 23:47:16.854775807')
664+
"""
665+
return max
666+
667+
def min(self):
668+
"""
669+
Return the minimum representable Timestamp.
670+
671+
This property returns the earliest datetime value that can be represented
672+
by a pandas.Timestamp object, which is equivalent to
673+
pd.Timestamp('1677-09-21 00:12:43.145224193').
674+
675+
Returns
676+
-------
677+
Timestamp
678+
The earliest representable Timestamp.
679+
680+
See Also
681+
--------
682+
Timestamp.max : Return the maximum representable Timestamp.
683+
684+
Examples
685+
--------
686+
>>> pd.Timestamp.min
687+
Timestamp('1677-09-21 00:12:43.145224193')
688+
"""
689+
return min
690+
615691
def hour(self) -> int:
616692
"""
617693
Returns the hour component of the timestamp.

0 commit comments

Comments
 (0)