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
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-29-f9de46fe6c54> in <module>
----> 1 ds.resample(time="24H").mean("time").time + to_offset("8H")
/usr/local/lib/python3.8/site-packages/xarray/core/dataarray.py in func(self, other)
2763
2764 variable = (
-> 2765 f(self.variable, other_variable)
2766 if not reflexive
2767 else f(other_variable, self.variable)
/usr/local/lib/python3.8/site-packages/xarray/core/variable.py in func(self, other)
2128 with np.errstate(all="ignore"):
2129 new_data = (
-> 2130 f(self_data, other_data)
2131 if not reflexive
2132 else f(other_data, self_data)
TypeError: unsupported operand type(s) for +: 'numpy.ndarray' and 'pandas._libs.tslibs.offsets.Hour'
This is an issue because pandas resampling has deprecated loffset — from our test suite:
xarray/tests/test_dataset.py::TestDataset::test_resample_loffset
/Users/maximilian/workspace/xarray/xarray/tests/test_dataset.py:3844: FutureWarning: 'loffset' in .resample() and in Grouper() is deprecated.
>>> df.resample(freq="3s", loffset="8H")
becomes:
>>> from pandas.tseries.frequencies import to_offset
>>> df = df.resample(freq="3s").mean()
>>> df.index = df.index.to_timestamp() + to_offset("8H")
ds.bar.to_series().resample("24H", loffset="-12H").mean()
...and so we'll need to support something like this in order to maintain existing behavior.
Describe the solution you'd like
I'm not completely sure; I think probably supporting the operations between xarray objects containing datetime objects and pandas' offset objects.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently xarray objects containting datetimes don't operate with pandas' offset objects:
raises:
This is an issue because pandas resampling has deprecated
loffset
— from our test suite:...and so we'll need to support something like this in order to maintain existing behavior.
Describe the solution you'd like
I'm not completely sure; I think probably supporting the operations between xarray objects containing datetime objects and pandas' offset objects.
The text was updated successfully, but these errors were encountered: