Closed
Description
Because frequencies.get_offset
may be broken by user operation because of its cache.
https://github.com/pydata/pandas/blob/master/pandas/tseries/frequencies.py#L515
import pandas as pd
x = pd.tseries.frequencies.get_offset('D')
x.__dict__
# {'normalize': False, 'kwds': {}, 'n': 1, '_offset': datetime.timedelta(1), '_named': 'D', '_use_relativedelta': False}
# modify its property
x.n = 5
# NG, modified instance is returned
y = pd.tseries.frequencies.get_offset('D')
y.__dict__
# {'normalize': False, 'kwds': {}, 'n': 5, '_offset': datetime.timedelta(1), '_named': 'D', '_use_relativedelta': False}
It should return a copy of the cache.