@@ -194,8 +194,6 @@ def rollback(self, someDate):
194
194
195
195
def rollforward (self , dt ):
196
196
"""Roll provided date forward to next offset only if not on offset"""
197
- if isinstance (dt , np .datetime64 ):
198
- dt = Timestamp (dt )
199
197
if not self .onOffset (dt ):
200
198
dt = dt + self .__class__ (1 , ** self .kwds )
201
199
return dt
@@ -297,8 +295,6 @@ def apply(self, other):
297
295
'datetime or timedelta!' )
298
296
@classmethod
299
297
def onOffset (cls , dt ):
300
- if isinstance (dt , np .datetime64 ):
301
- dt = Timestamp (dt )
302
298
return dt .weekday () < 5
303
299
304
300
@@ -636,8 +632,6 @@ def apply(self, other):
636
632
first = _get_firstbday (wkday )
637
633
638
634
monthsSince = (other .month - self .startingMonth ) % 3
639
- if monthsSince == 3 : # on offset
640
- monthsSince = 0
641
635
642
636
if n <= 0 and monthsSince != 0 : # make sure to roll forward so negate
643
637
monthsSince = monthsSince - 3
@@ -728,9 +722,6 @@ def apply(self, other):
728
722
729
723
monthsSince = (other .month - self .startingMonth ) % 3
730
724
731
- if monthsSince == 3 : # on an offset
732
- monthsSince = 0
733
-
734
725
if n <= 0 and monthsSince != 0 :
735
726
# make sure you roll forward, so negate
736
727
monthsSince = monthsSince - 3
@@ -756,7 +747,7 @@ def __init__(self, n=1, **kwds):
756
747
self .month = kwds .get ('month' , 12 )
757
748
758
749
if self .month < 1 or self .month > 12 :
759
- raise Exception ('Month must go from 1 to 12' )
750
+ raise ValueError ('Month must go from 1 to 12' )
760
751
761
752
DateOffset .__init__ (self , n = n , ** kwds )
762
753
@@ -803,7 +794,7 @@ def __init__(self, n=1, **kwds):
803
794
self .month = kwds .get ('month' , 1 )
804
795
805
796
if self .month < 1 or self .month > 12 :
806
- raise Exception ('Month must go from 1 to 12' )
797
+ raise ValueError ('Month must go from 1 to 12' )
807
798
808
799
DateOffset .__init__ (self , n = n , ** kwds )
809
800
@@ -845,7 +836,7 @@ def __init__(self, n=1, **kwds):
845
836
self .month = kwds .get ('month' , 12 )
846
837
847
838
if self .month < 1 or self .month > 12 :
848
- raise Exception ('Month must go from 1 to 12' )
839
+ raise ValueError ('Month must go from 1 to 12' )
849
840
850
841
DateOffset .__init__ (self , n = n , ** kwds )
851
842
@@ -911,7 +902,7 @@ def __init__(self, n=1, **kwds):
911
902
self .month = kwds .get ('month' , 12 )
912
903
913
904
if self .month < 1 or self .month > 12 :
914
- raise Exception ('Month must go from 1 to 12' )
905
+ raise ValueError ('Month must go from 1 to 12' )
915
906
916
907
DateOffset .__init__ (self , n = n , ** kwds )
917
908
@@ -1012,7 +1003,7 @@ def _delta_to_tick(delta):
1012
1003
return Milli (nanos // 1000000 )
1013
1004
elif nanos % 1000 == 0 :
1014
1005
return Micro (nanos // 1000 )
1015
- else :
1006
+ else : # pragma: no cover
1016
1007
return Nano (nanos )
1017
1008
1018
1009
def _delta_to_nanoseconds (delta ):
@@ -1114,9 +1105,6 @@ def generate_range(start=None, end=None, periods=None,
1114
1105
end = None
1115
1106
periods = 0
1116
1107
1117
- if _count_not_none (start , end , periods ) < 2 :
1118
- raise ValueError ('Must specify 2 of start, end, periods' )
1119
-
1120
1108
if end is None :
1121
1109
end = start + (periods - 1 ) * offset
1122
1110
0 commit comments