From fbbf8799e75a9afd9b9ca4ed1f625dddb8172cb8 Mon Sep 17 00:00:00 2001 From: jreback Date: Wed, 11 Mar 2015 18:45:52 -0400 Subject: [PATCH] COMPAT: dtype fix for windows tests; ensure passing i8 to tslib/normalize routines --- pandas/tseries/tests/test_resample.py | 2 +- pandas/tslib.pyx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pandas/tseries/tests/test_resample.py b/pandas/tseries/tests/test_resample.py index 3e565d5764fe2..c338bbeae79c7 100644 --- a/pandas/tseries/tests/test_resample.py +++ b/pandas/tseries/tests/test_resample.py @@ -884,7 +884,7 @@ def test_resmaple_dst_anchor(self): dti = date_range('2013-09-30', '2013-11-02', freq='30Min', tz='Europe/Paris') values = range(dti.size) - df = DataFrame({"a": values, "b": values, "c": values}, index=dti) + df = DataFrame({"a": values, "b": values, "c": values}, index=dti, dtype='int64') how = {"a": "min", "b": "max", "c": "count"} assert_frame_equal(df.resample("W-MON", how=how)[["a", "b", "c"]], diff --git a/pandas/tslib.pyx b/pandas/tslib.pyx index 763c06c7d4e7c..3f04f80406fca 100644 --- a/pandas/tslib.pyx +++ b/pandas/tslib.pyx @@ -456,7 +456,7 @@ class Timestamp(_Timestamp): tz = maybe_get_tz(tz) if not isinstance(ambiguous, basestring): ambiguous = [ambiguous] - value = tz_localize_to_utc(np.array([self.value]), tz, + value = tz_localize_to_utc(np.array([self.value],dtype='i8'), tz, ambiguous=ambiguous)[0] return Timestamp(value, tz=tz) else: @@ -468,6 +468,7 @@ class Timestamp(_Timestamp): raise TypeError('Cannot localize tz-aware Timestamp, use ' 'tz_convert for conversions') + def tz_convert(self, tz): """ Convert Timestamp to another time zone or localize to requested time @@ -569,7 +570,7 @@ class Timestamp(_Timestamp): Normalize Timestamp to midnight, preserving tz information. """ - normalized_value = date_normalize(np.array([self.value]), tz=self.tz)[0] + normalized_value = date_normalize(np.array([self.value], dtype='i8'), tz=self.tz)[0] return Timestamp(normalized_value).tz_localize(self.tz) def __radd__(self, other):