@@ -726,7 +726,7 @@ def _interval_group(freqstr):
726
726
727
727
def _get_freq_code (freqstr ):
728
728
if isinstance (freqstr , DateOffset ):
729
- freqstr = (getOffsetName (freqstr ), freqstr .n )
729
+ freqstr = (get_offset_name (freqstr ), freqstr .n )
730
730
731
731
if isinstance (freqstr , tuple ):
732
732
if (isinstance (freqstr [0 ], (int , long )) and
@@ -1943,10 +1943,11 @@ def rule_code(self):
1943
1943
'BAS-NOV' : BYearBegin (month = 11 ),
1944
1944
'BAS-DEC' : BYearBegin (month = 12 ),
1945
1945
# Quarterly - Calendar
1946
+ # 'Q' : QuarterEnd(startingMonth=3),
1947
+
1946
1948
'Q-JAN' : QuarterEnd (startingMonth = 1 ),
1947
1949
'Q-FEB' : QuarterEnd (startingMonth = 2 ),
1948
1950
'Q-MAR' : QuarterEnd (startingMonth = 3 ),
1949
- 'Q' : QuarterEnd (startingMonth = 3 ),
1950
1951
'Q-APR' : QuarterEnd (startingMonth = 4 ),
1951
1952
'Q-MAY' : QuarterEnd (startingMonth = 5 ),
1952
1953
'Q-JUN' : QuarterEnd (startingMonth = 6 ),
@@ -1957,8 +1958,9 @@ def rule_code(self):
1957
1958
'Q-NOV' : QuarterEnd (startingMonth = 11 ),
1958
1959
'Q-DEC' : QuarterEnd (startingMonth = 12 ),
1959
1960
# Quarterly - Calendar (Start)
1961
+ # 'QS' : QuarterBegin(startingMonth=1),
1962
+
1960
1963
'QS-JAN' : QuarterBegin (startingMonth = 1 ),
1961
- 'QS' : QuarterBegin (startingMonth = 1 ),
1962
1964
'QS-FEB' : QuarterBegin (startingMonth = 2 ),
1963
1965
'QS-MAR' : QuarterBegin (startingMonth = 3 ),
1964
1966
'QS-APR' : QuarterBegin (startingMonth = 4 ),
@@ -1974,7 +1976,9 @@ def rule_code(self):
1974
1976
'BQ-JAN' : BQuarterEnd (startingMonth = 1 ),
1975
1977
'BQ-FEB' : BQuarterEnd (startingMonth = 2 ),
1976
1978
'BQ-MAR' : BQuarterEnd (startingMonth = 3 ),
1977
- 'BQ' : BQuarterEnd (startingMonth = 3 ),
1979
+
1980
+ # 'BQ' : BQuarterEnd(startingMonth=3),
1981
+
1978
1982
'BQ-APR' : BQuarterEnd (startingMonth = 4 ),
1979
1983
'BQ-MAY' : BQuarterEnd (startingMonth = 5 ),
1980
1984
'BQ-JUN' : BQuarterEnd (startingMonth = 6 ),
@@ -2056,6 +2060,8 @@ def rule_code(self):
2056
2060
}
2057
2061
2058
2062
2063
+ _legacy_reverse_map = dict ((v , k ) for k , v in _rule_aliases .iteritems ())
2064
+
2059
2065
for i , weekday in enumerate (['MON' , 'TUE' , 'WED' , 'THU' , 'FRI' ]):
2060
2066
for iweek in xrange (4 ):
2061
2067
_offset_map ['WOM@%d%s' % (iweek + 1 , weekday )] = \
@@ -2174,13 +2180,13 @@ def get_offset(name):
2174
2180
def hasOffsetName (offset ):
2175
2181
return offset in _offset_names
2176
2182
2177
- def getOffsetName (offset ):
2183
+ def get_offset_name (offset ):
2178
2184
"""
2179
2185
Return rule name associated with a DateOffset object
2180
2186
2181
2187
Example
2182
2188
-------
2183
- getOffsetName (BMonthEnd(1)) --> 'EOM'
2189
+ get_offset_name (BMonthEnd(1)) --> 'EOM'
2184
2190
"""
2185
2191
name = _offset_names .get (offset )
2186
2192
@@ -2189,6 +2195,15 @@ def getOffsetName(offset):
2189
2195
else :
2190
2196
raise Exception ('Bad rule given: %s!' % offset )
2191
2197
2198
+ def get_legacy_offset_name (offset ):
2199
+ """
2200
+ Return the pre pandas 0.8.0 name for the date offset
2201
+ """
2202
+ name = _offset_names .get (offset )
2203
+ return _legacy_reverse_map .get (name , name )
2204
+
2205
+ get_offset_name = get_offset_name
2206
+
2192
2207
def get_standard_freq (freq ):
2193
2208
"""
2194
2209
Return the standardized frequency string
@@ -2197,7 +2212,7 @@ def get_standard_freq(freq):
2197
2212
return None
2198
2213
2199
2214
if isinstance (freq , DateOffset ):
2200
- return getOffsetName (freq )
2215
+ return get_offset_name (freq )
2201
2216
2202
2217
code , stride = _get_freq_code (freq )
2203
2218
return _get_freq_str (code , stride )
0 commit comments