Skip to content

Commit c60a6ed

Browse files
committed
Updated exceptions raised in resample
1 parent 190bed2 commit c60a6ed

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pandas/tseries/resample.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,13 @@ def _resample_timestamps(self, kind=None):
323323

324324
result.index = result.index + loffset
325325

326-
if self.base > 0:
327-
result.index = result.index.shift(self.base, self.freq)
326+
if type(self.base) != int:
327+
raise Exception("Expect base to be int, got {type}"
328+
.format(type = type(self.base)))
329+
330+
if self.base > 0 and self.base < self.freq.n:
331+
shift_freq = type(self.freq)(1)
332+
result.index = result.index.shift(self.base, shift_freq)
328333

329334
return result
330335

0 commit comments

Comments
 (0)