Closed
Description
This change in 1.0 impacted xarray
In [22]: import xarray as xr
In [23]: import pandas as pd
In [24]: idx = pd.timedelta_range("1D", periods=5, freq="D")
In [25]: a = xr.cftime_range("2000", periods=5)
In [26]: idx + a
/Users/taugspurger/sandbox/pandas/pandas/core/arrays/datetimelike.py:1204: PerformanceWarning: Adding/subtracting array of DateOffsets to TimedeltaArray not vectorized
PerformanceWarning,
Out[26]:
Index([2000-01-02 00:00:00, 2000-01-04 00:00:00, 2000-01-06 00:00:00,
2000-01-08 00:00:00, 2000-01-10 00:00:00],
dtype='object')
In [27]: a + idx
Out[27]:
CFTimeIndex([2000-01-02 00:00:00, 2000-01-04 00:00:00, 2000-01-06 00:00:00,
2000-01-08 00:00:00, 2000-01-10 00:00:00],
dtype='object')
cc @jbrockmendel @dcherian. Brock suggested checking type(other)
, and returning NotImplemented for index subclasses we don't know about, to give the subclass a chance to take over the op.