diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index ec8478f3fc82a..afa678a6751af 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -856,12 +856,11 @@ cdef class _Timestamp(ABCTimestamp): local_val = self._maybe_convert_value_to_local() int64_t normalized int64_t ppd = periods_per_day(self._reso) - - if self._reso != NPY_FR_ns: - raise NotImplementedError(self._reso) + _Timestamp ts normalized = normalize_i8_stamp(local_val, ppd) - return Timestamp(normalized).tz_localize(self.tzinfo) + ts = type(self)._from_value_and_reso(normalized, reso=self._reso, tz=None) + return ts.tz_localize(self.tzinfo) # ----------------------------------------------------------------- # Pickle Methods @@ -2035,6 +2034,8 @@ default 'raise' NaT """ if self._reso != NPY_FR_ns: + if tz is None and self.tz is None: + return self raise NotImplementedError(self._reso) if ambiguous == 'infer': diff --git a/pandas/tests/scalar/timestamp/test_timestamp.py b/pandas/tests/scalar/timestamp/test_timestamp.py index 292c8f95ec2e6..36c3803ef41ff 100644 --- a/pandas/tests/scalar/timestamp/test_timestamp.py +++ b/pandas/tests/scalar/timestamp/test_timestamp.py @@ -715,11 +715,11 @@ def test_non_nano_construction(self, dt64, ts, reso): assert ts.value == dt64.view("i8") if reso == "s": - assert ts._reso == 7 + assert ts._reso == NpyDatetimeUnit.NPY_FR_s.value elif reso == "ms": - assert ts._reso == 8 + assert ts._reso == NpyDatetimeUnit.NPY_FR_ms.value elif reso == "us": - assert ts._reso == 9 + assert ts._reso == NpyDatetimeUnit.NPY_FR_us.value def test_non_nano_fields(self, dt64, ts): alt = Timestamp(dt64) @@ -830,6 +830,12 @@ def test_pickle(self, ts): assert rt._reso == ts._reso assert rt == ts + def test_normalize(self, dt64, ts): + alt = Timestamp(dt64) + result = ts.normalize() + assert result._reso == ts._reso + assert result == alt.normalize() + def test_asm8(self, dt64, ts): rt = ts.asm8 assert rt == dt64