Skip to content

Commit

Permalink
!B [pandas-dev#15549] resample with tz-aware: Values falls after last…
Browse files Browse the repository at this point in the history
… bin
  • Loading branch information
ahcub authored Mar 2, 2017
1 parent cd67704 commit 68a02aa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pandas/tseries/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,17 +1144,18 @@ def _get_time_bins(self, ax):
if not isinstance(ax, DatetimeIndex):
raise TypeError('axis must be a DatetimeIndex, but got '
'an instance of %r' % type(ax).__name__)

if len(ax) == 0:
binner = labels = DatetimeIndex(
data=[], freq=self.freq, name=ax.name)
return binner, [], labels


tz = ax.tz
ax = ax.tz_convert('UTC')

first, last = ax.min(), ax.max()
first, last = _get_range_edges(first, last, self.freq,
closed=self.closed,
base=self.base)
tz = ax.tz
# GH #12037
# use first/last directly instead of call replace() on them
# because replace() will swallow the nanosecond part
Expand All @@ -1163,8 +1164,7 @@ def _get_time_bins(self, ax):
binner = labels = DatetimeIndex(freq=self.freq,
start=first,
end=last,
tz=tz,
name=ax.name)
name=ax.name).tz_convert(tz)

# a little hack
trimmed = False
Expand Down

0 comments on commit 68a02aa

Please sign in to comment.