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 have searched the [pandas] tag on StackOverflow for similar questions.
I have asked my usage related question on StackOverflow.
Question about pandas
In xarray we make use of an Index subclass for datetime-like indexing with non-standard calendars, which we call CFTimeIndex. A recent change, #37087, led to some test failures on our end. We currently do not define an _id attribute on our subclass, so we are vulnerable to the kinds of attribute errors illustrated below (note this example requires the xarray and cftime libraries be installed, with the development version of pandas):
In [1]: import xarray as xr
In [2]: xr.cftime_range("2000", periods=2).view()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-5226cd5e3bc1> in <module>
----> 1 xr.cftime_range("2000", periods=2).view()
~/Software/pandas/pandas/core/indexes/base.py in view(self, cls)
630 result = self._shallow_copy()
631 if isinstance(result, Index):
--> 632 result._id = self._id
633 return result
634
AttributeError: 'CFTimeIndex' object has no attribute '_id'
Where possible, we try to avoid using private methods/attributes on our subclass. In this case would you recommend we go against that by setting the _id attribute, e.g. by using _reset_identity in our constructor, or would it be possible to continue to have _id be somewhat of an optional attribute of Index objects in pandas?
The text was updated successfully, but these errors were encountered:
I have searched the [pandas] tag on StackOverflow for similar questions.
I have asked my usage related question on StackOverflow.
Question about pandas
In xarray we make use of an
Index
subclass for datetime-like indexing with non-standard calendars, which we callCFTimeIndex
. A recent change, #37087, led to some test failures on our end. We currently do not define an_id
attribute on our subclass, so we are vulnerable to the kinds of attribute errors illustrated below (note this example requires the xarray and cftime libraries be installed, with the development version of pandas):Where possible, we try to avoid using private methods/attributes on our subclass. In this case would you recommend we go against that by setting the
_id
attribute, e.g. by using_reset_identity
in our constructor, or would it be possible to continue to have_id
be somewhat of an optional attribute ofIndex
objects in pandas?The text was updated successfully, but these errors were encountered: