8
8
# import after tools, dateutil check
9
9
from dateutil .relativedelta import relativedelta
10
10
import pandas .tslib as tslib
11
+ from pandas .tslib import Timestamp
11
12
import numpy as np
12
13
from pandas import _np_version_under1p7
13
14
@@ -92,9 +93,9 @@ def apply(self, other):
92
93
else :
93
94
for i in range (- self .n ):
94
95
other = other - self ._offset
95
- return other
96
+ return Timestamp ( other )
96
97
else :
97
- return other + timedelta (self .n )
98
+ return Timestamp ( other + timedelta (self .n ) )
98
99
99
100
def isAnchored (self ):
100
101
return (self .n == 1 )
@@ -373,7 +374,7 @@ def apply(self, other):
373
374
if self .offset :
374
375
result = result + self .offset
375
376
376
- return result
377
+ return Timestamp ( result )
377
378
378
379
elif isinstance (other , (timedelta , Tick )):
379
380
return BDay (self .n , offset = self .offset + other ,
@@ -516,7 +517,7 @@ def apply(self, other):
516
517
if n <= 0 :
517
518
n = n + 1
518
519
other = other + relativedelta (months = n , day = 31 )
519
- return other
520
+ return Timestamp ( other )
520
521
521
522
@classmethod
522
523
def onOffset (cls , dt ):
@@ -538,7 +539,7 @@ def apply(self, other):
538
539
n += 1
539
540
540
541
other = other + relativedelta (months = n , day = 1 )
541
- return other
542
+ return Timestamp ( other )
542
543
543
544
@classmethod
544
545
def onOffset (cls , dt ):
@@ -660,7 +661,7 @@ def apply(self, other):
660
661
other = other + timedelta ((self .weekday - otherDay ) % 7 )
661
662
for i in range (- k ):
662
663
other = other - self ._inc
663
- return other
664
+ return Timestamp ( other )
664
665
665
666
def onOffset (self , dt ):
666
667
return dt .weekday () == self .weekday
@@ -901,7 +902,7 @@ def apply(self, other):
901
902
902
903
other = other + relativedelta (months = monthsToGo + 3 * n , day = 31 )
903
904
904
- return other
905
+ return Timestamp ( other )
905
906
906
907
def onOffset (self , dt ):
907
908
modMonth = (dt .month - self .startingMonth ) % 3
@@ -941,7 +942,7 @@ def apply(self, other):
941
942
n = n + 1
942
943
943
944
other = other + relativedelta (months = 3 * n - monthsSince , day = 1 )
944
- return other
945
+ return Timestamp ( other )
945
946
946
947
@property
947
948
def rule_code (self ):
@@ -1093,7 +1094,7 @@ def _rollf(date):
1093
1094
# n == 0, roll forward
1094
1095
result = _rollf (result )
1095
1096
1096
- return result
1097
+ return Timestamp ( result )
1097
1098
1098
1099
def onOffset (self , dt ):
1099
1100
wkday , days_in_month = tslib .monthrange (dt .year , self .month )
@@ -1151,7 +1152,7 @@ def _rollf(date):
1151
1152
# n == 0, roll forward
1152
1153
result = _rollf (result )
1153
1154
1154
- return result
1155
+ return Timestamp ( result )
1155
1156
1156
1157
def onOffset (self , dt ):
1157
1158
return dt .month == self .month and dt .day == 1
0 commit comments