diff --git a/pandas/_libs/tslibs/timestamps.pxd b/pandas/_libs/tslibs/timestamps.pxd index 0ecb26822cf50..46ded96b47c4d 100644 --- a/pandas/_libs/tslibs/timestamps.pxd +++ b/pandas/_libs/tslibs/timestamps.pxd @@ -22,7 +22,7 @@ cdef _Timestamp create_timestamp_from_ts(int64_t value, cdef class _Timestamp(ABCTimestamp): cdef readonly: - int64_t value, nanosecond, year + int64_t value, nanosecond, year, _hour BaseOffset _freq NPY_DATETIMEUNIT _reso diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 07c6e32028942..49d9929f3d8f0 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -165,6 +165,7 @@ cdef inline _Timestamp create_timestamp_from_ts( ts_base.value = value ts_base._freq = freq ts_base.year = dts.year + ts_base._hour = dts.hour ts_base.nanosecond = dts.ps // 1000 ts_base._reso = reso @@ -2369,6 +2370,13 @@ default 'raise' self.nanosecond / 3600.0 / 1e+9 ) / 24.0) + @property + def hour(self): + """ + My hour + """ + return self._hour + def isoweekday(self): """ Return the day of the week represented by the date.