Skip to content

Commit d881ba2

Browse files
committed
BLD: fix odd usage of cython imports, xref (GH8602)
1 parent f2f88c6 commit d881ba2

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

doc/source/whatsnew/v0.15.2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Experimental
5858

5959
Bug Fixes
6060
~~~~~~~~~
61+
- Bug in packaging pandas with ``py2app/cx_Freeze`` (:issue:`8602`, :issue:`8831`)
6162
- Bug in ``groupby`` signatures that didn't include \*args or \*\*kwargs (:issue:`8733`).
6263
- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo and when it receives no data from Yahoo (:issue:`8761`), (:issue:`8783`).
6364
- Bug in slicing a multi-index with an empty list and at least one boolean indexer (:issue:`8781`)

pandas/tslib.pyx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,16 +1633,16 @@ class Timedelta(_Timedelta):
16331633
if value is None:
16341634
if not len(kwargs):
16351635
raise ValueError("cannot construct a TimeDelta without a value/unit or descriptive keywords (days,seconds....)")
1636-
1636+
16371637
def _to_py_int_float(v):
16381638
if is_integer_object(v):
16391639
return int(v)
16401640
elif is_float_object(v):
16411641
return float(v)
16421642
raise TypeError("Invalid type {0}. Must be int or float.".format(type(v)))
1643-
1643+
16441644
kwargs = dict([ (k, _to_py_int_float(v)) for k, v in iteritems(kwargs) ])
1645-
1645+
16461646
try:
16471647
value = timedelta(**kwargs)
16481648
except TypeError as e:
@@ -2753,8 +2753,7 @@ def tz_localize_to_utc(ndarray[int64_t] vals, object tz, object ambiguous=None):
27532753
result_b.fill(NPY_NAT)
27542754

27552755
# left side
2756-
idx_shifted = ensure_int64(
2757-
np.maximum(0, trans.searchsorted(vals - DAY_NS, side='right') - 1))
2756+
idx_shifted = (np.maximum(0, trans.searchsorted(vals - DAY_NS, side='right') - 1)).astype(np.int64)
27582757

27592758
for i in range(n):
27602759
v = vals[i] - deltas[idx_shifted[i]]
@@ -2765,8 +2764,7 @@ def tz_localize_to_utc(ndarray[int64_t] vals, object tz, object ambiguous=None):
27652764
result_a[i] = v
27662765

27672766
# right side
2768-
idx_shifted = ensure_int64(
2769-
np.maximum(0, trans.searchsorted(vals + DAY_NS, side='right') - 1))
2767+
idx_shifted = (np.maximum(0, trans.searchsorted(vals + DAY_NS, side='right') - 1)).astype(np.int64)
27702768

27712769
for i in range(n):
27722770
v = vals[i] - deltas[idx_shifted[i]]
@@ -2850,10 +2848,6 @@ def tz_localize_to_utc(ndarray[int64_t] vals, object tz, object ambiguous=None):
28502848

28512849
return result
28522850

2853-
import pandas.algos as algos
2854-
ensure_int64 = algos.ensure_int64
2855-
2856-
28572851
cdef inline bisect_right_i8(int64_t *data, int64_t val, Py_ssize_t n):
28582852
cdef Py_ssize_t pivot, left = 0, right = n
28592853

0 commit comments

Comments
 (0)