From 6b6f4b25113ec28954bb0f7a8a9ea5d88d40b66c Mon Sep 17 00:00:00 2001
From: David Li
Date: Wed, 25 Nov 2020 17:54:24 -0500
Subject: [PATCH] PERF: fix regression in tz_convert_from_utc
---
pandas/_libs/tslibs/tzconversion.pyx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pandas/_libs/tslibs/tzconversion.pyx b/pandas/_libs/tslibs/tzconversion.pyx
index f08a86b1262e6..1049682af08e8 100644
--- a/pandas/_libs/tslibs/tzconversion.pyx
+++ b/pandas/_libs/tslibs/tzconversion.pyx
@@ -426,7 +426,7 @@ def tz_convert_from_utc(const int64_t[:] vals, tzinfo tz):
int64 ndarray of converted
"""
cdef:
- int64_t[:] converted
+ const int64_t[:] converted
if len(vals) == 0:
return np.array([], dtype=np.int64)
@@ -437,7 +437,7 @@ def tz_convert_from_utc(const int64_t[:] vals, tzinfo tz):
@cython.boundscheck(False)
@cython.wraparound(False)
-cdef int64_t[:] _tz_convert_from_utc(const int64_t[:] vals, tzinfo tz):
+cdef const int64_t[:] _tz_convert_from_utc(const int64_t[:] vals, tzinfo tz):
"""
Convert the given values (in i8) either to UTC or from UTC.
@@ -459,7 +459,7 @@ cdef int64_t[:] _tz_convert_from_utc(const int64_t[:] vals, tzinfo tz):
str typ
if is_utc(tz):
- converted = vals.copy()
+ return vals
elif is_tzlocal(tz):
converted = np.empty(n, dtype=np.int64)
for i in range(n):