41
41
'LastWeekOfMonth' , 'FY5253Quarter' , 'FY5253' ,
42
42
'Week' , 'WeekOfMonth' , 'Easter' ,
43
43
'Hour' , 'Minute' , 'Second' , 'Milli' , 'Micro' , 'Nano' ,
44
- 'DateOffset' , 'CalendarDay' ]
44
+ 'DateOffset' ]
45
45
46
46
# convert to/from datetime/timestamp to allow invalid Timestamp ranges to
47
47
# pass thru
@@ -2124,14 +2124,15 @@ def onOffset(self, dt):
2124
2124
return date (dt .year , dt .month , dt .day ) == easter (dt .year )
2125
2125
2126
2126
2127
- class CalendarDay (SingleConstructorOffset ):
2127
+ class Day (SingleConstructorOffset ):
2128
2128
"""
2129
- Calendar day offset. Respects calendar arithmetic as opposed to Day which
2130
- respects absolute time.
2129
+ Day offset representing a calendar day. Respects calendar day arithmetic
2130
+ in the midst of daylight savings time transitions; therefore, Day does not
2131
+ necessarily equate to 24 hours.
2131
2132
"""
2132
2133
_adjust_dst = True
2133
2134
_inc = Timedelta (days = 1 )
2134
- _prefix = 'CD '
2135
+ _prefix = 'D '
2135
2136
_attributes = frozenset (['n' , 'normalize' ])
2136
2137
2137
2138
def __init__ (self , n = 1 , normalize = False ):
@@ -2140,11 +2141,11 @@ def __init__(self, n=1, normalize=False):
2140
2141
@apply_wraps
2141
2142
def apply (self , other ):
2142
2143
"""
2143
- Apply scalar arithmetic with CalendarDay offset. Incoming datetime
2144
+ Apply scalar arithmetic with Day offset. Incoming datetime
2144
2145
objects can be tz-aware or naive.
2145
2146
"""
2146
2147
if type (other ) == type (self ):
2147
- # Add other CalendarDays
2148
+ # Add other Days
2148
2149
return type (self )(self .n + other .n , normalize = self .normalize )
2149
2150
tzinfo = getattr (other , 'tzinfo' , None )
2150
2151
if tzinfo is not None :
@@ -2160,12 +2161,12 @@ def apply(self, other):
2160
2161
return as_timestamp (other )
2161
2162
except TypeError :
2162
2163
raise TypeError ("Cannot perform arithmetic between {other} and "
2163
- "CalendarDay " .format (other = type (other )))
2164
+ "Day " .format (other = type (other )))
2164
2165
2165
2166
@apply_index_wraps
2166
2167
def apply_index (self , i ):
2167
2168
"""
2168
- Apply the CalendarDay offset to a DatetimeIndex. Incoming DatetimeIndex
2169
+ Apply the Day offset to a DatetimeIndex. Incoming DatetimeIndex
2169
2170
objects are assumed to be tz_naive
2170
2171
"""
2171
2172
return i + self .n * self ._inc
@@ -2302,11 +2303,6 @@ def _delta_to_tick(delta):
2302
2303
return Nano (nanos )
2303
2304
2304
2305
2305
- class Day (Tick ):
2306
- _inc = Timedelta (days = 1 )
2307
- _prefix = 'D'
2308
-
2309
-
2310
2306
class Hour (Tick ):
2311
2307
_inc = Timedelta (hours = 1 )
2312
2308
_prefix = 'H'
@@ -2455,5 +2451,4 @@ def generate_range(start=None, end=None, periods=None,
2455
2451
WeekOfMonth , # 'WOM'
2456
2452
FY5253 ,
2457
2453
FY5253Quarter ,
2458
- CalendarDay # 'CD'
2459
2454
]}
0 commit comments