You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that many of the DateOffsets that extend CacheableOffset do so incorrectly.
Looking at pandas.tseries.offsets, there are some subclasses of DateOffset are declared as class Foo(DateOffset, CacheableOffset) and some as class Foo(CacheableOffset, DateOffset).
All that CacheableOffset does is to set the class field _cacheable = True. DateOffset sets _cacheable = False. Therefore, depending on the order of the parent classes, in some cases _cacheable will be False and some cases True
The text was updated successfully, but these errors were encountered:
That code does not look old. I am not exactly sure how _cacheable is being used; I will have to look more closely. I can certainly provide a python example of how it is broken:
class Cache(object):
_foo = True
class DT(object):
_foo = False
class A(Cache, DT):
pass
class Bob(DT, Cache):
pass
B()._foo
False
A()._foo
True
I take that back. I found the following in tseries.index:
if (offset._should_cache() and
not (offset._normalize_cache and not _normalized) and
_naive_in_cache_range(start, end)):
index = cls._cached_range(start, end, periods=periods,
offset=offset, name=name)
else:
index = _generate_regular_range(start, end, periods, offset)
I believe that many of the
DateOffset
s that extendCacheableOffset
do so incorrectly.Looking at
pandas.tseries.offsets
, there are some subclasses ofDateOffset
are declared asclass Foo(DateOffset, CacheableOffset)
and some asclass Foo(CacheableOffset, DateOffset)
.All that
CacheableOffset
does is to set the class field_cacheable = True
.DateOffset
sets_cacheable = False
. Therefore, depending on the order of the parent classes, in some cases_cacheable
will beFalse
and some casesTrue
The text was updated successfully, but these errors were encountered: