diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index ec8478f3fc82a..3d43e5c91e604 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -2112,8 +2112,6 @@ default 'raise' >>> pd.NaT.tz_convert(tz='Asia/Tokyo') NaT """ - if self._reso != NPY_FR_ns: - raise NotImplementedError(self._reso) if self.tzinfo is None: # tz naive, use tz_localize @@ -2122,7 +2120,8 @@ default 'raise' ) else: # Same UTC timestamp, different time zone - out = Timestamp(self.value, tz=tz) + tz = maybe_get_tz(tz) + out = type(self)._from_value_and_reso(self.value, reso=self._reso, tz=tz) if out is not NaT: out._set_freq(self._freq) # avoid warning in constructor return out diff --git a/pandas/tests/scalar/timestamp/test_timestamp.py b/pandas/tests/scalar/timestamp/test_timestamp.py index 292c8f95ec2e6..d7c157885c77e 100644 --- a/pandas/tests/scalar/timestamp/test_timestamp.py +++ b/pandas/tests/scalar/timestamp/test_timestamp.py @@ -22,6 +22,7 @@ from pandas._libs.tslibs.timezones import ( dateutil_gettz as gettz, get_timezone, + tz_compare, ) from pandas.errors import OutOfBoundsDatetime import pandas.util._test_decorators as td @@ -763,6 +764,16 @@ def test_month_name(self, dt64, ts): alt = Timestamp(dt64) assert ts.month_name() == alt.month_name() + def test_tz_convert(self, ts): + ts = Timestamp._from_value_and_reso(ts.value, ts._reso, utc) + + tz = pytz.timezone("US/Pacific") + result = ts.tz_convert(tz) + + assert isinstance(result, Timestamp) + assert result._reso == ts._reso + assert tz_compare(result.tz, tz) + def test_repr(self, dt64, ts): alt = Timestamp(dt64)