Skip to content

Commit 3b0f698

Browse files
committed
BUG: Fix resampling of tz-aware time series with anchored freq close #1591
1 parent aa5f824 commit 3b0f698

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

RELEASE.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pandas 0.8.1
5353
- Fix MultiIndex console formatting issue (#1606)
5454
- Unordered index with duplicates doesn't yield scalar location for single
5555
entry (#1586)
56+
- Fix resampling of tz-aware time series with "anchored" freq (#1591)
5657

5758
pandas 0.8.0
5859
============

pandas/tseries/resample.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ def _get_time_bins(self, axis):
9090
binner = labels = DatetimeIndex(data=[], freq=self.freq)
9191
return binner, [], labels
9292

93-
first, last = _get_range_edges(axis, self.freq, closed=self.closed,
94-
base=self.base)
93+
first, last = _get_range_edges(axis, self.freq, closed=self.closed, base=self.base)
9594
binner = labels = DatetimeIndex(freq=self.freq, start=first, end=last)
9695

9796
# a little hack
@@ -304,7 +303,8 @@ def _adjust_dates_anchored(first, last, offset, closed='right', base=0):
304303
else:
305304
lresult = last.value + offset.nanos
306305

307-
return Timestamp(fresult), Timestamp(lresult)
306+
return (Timestamp(fresult, tz=first.tz),
307+
Timestamp(lresult, tz=last.tz))
308308

309309

310310
def asfreq(obj, freq, method=None, how=None):

pandas/tseries/tests/test_resample.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,9 @@ def test_resample_tz_localized(self):
731731

732732
assert_series_equal(result, exp)
733733

734+
# it works
735+
result = ts_local.resample('D')
736+
734737
def test_closed_left_corner(self):
735738
# #1465
736739
s = Series(np.random.randn(21),

0 commit comments

Comments
 (0)