From 52a5f987bc077de4cf5c824b60f32f691b868de6 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Wed, 6 Sep 2017 20:19:42 -0700 Subject: [PATCH] cdef out dtype for _Timestamp._get_field --- pandas/_libs/tslib.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index a7b33c669a8b8..7e009652f7f0c 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -1275,6 +1275,7 @@ cdef class _Timestamp(datetime): cpdef _get_field(self, field): cdef: int64_t val + ndarray[int32_t] out val = self._maybe_convert_value_to_local() out = get_date_field(np.array([val], dtype=np.int64), field) return int(out[0]) @@ -1282,6 +1283,7 @@ cdef class _Timestamp(datetime): cpdef _get_named_field(self, field): cdef: int64_t val + ndarray[object] out val = self._maybe_convert_value_to_local() out = get_date_name_field(np.array([val], dtype=np.int64), field) return out[0] @@ -1291,9 +1293,7 @@ cdef class _Timestamp(datetime): 'startingMonth', self.freq.kwds.get( 'month', 12)) if self.freq else 12 freqstr = self.freqstr if self.freq else None - val = self.value - if self.tz is not None and not _is_utc(self.tz): - val = tz_convert_single(self.value, 'UTC', self.tz) + val = self._maybe_convert_value_to_local() out = get_start_end_field( np.array([val], dtype=np.int64), field, freqstr, month_kw) return out[0]