Closed
Description
Many / most of the entries in _offset_map
look like:
_offset_map['X'] = OffsetX()
where X
is a string literal for what would have been returned by OffsetX().rule_code
See for example: https://github.com/pydata/pandas/blob/master/pandas/tseries/frequencies.py#L132
This makes adding to and maintaining the list of Offsets more cumbersome.
Manually populating _offset_map
could be reserved for cases in which the entry in _offset_map
is not the same as the rule_code
. The remaining cases would be auto-populated using a classmethod
on the Offset to return all possible Offsets.
A related map is _offset_names
One suggestion would be to change get_offset_name
to return offset.rule_code
in the else case rather than raising an exception. This would remove the need for _offset_names