html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/6597#issuecomment-1124868221,https://api.github.com/repos/pydata/xarray/issues/6597,1124868221,IC_kwDOAMm_X85DDCB9,43316012,2022-05-12T11:18:14Z,2022-05-12T11:18:14Z,COLLABORATOR,"Ok, the first idea does not work since values is a numpy array. The second idea should work, so this is a bug. It seems that polyval does not work with timedeltas, I will look into that.","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1233717699 https://github.com/pydata/xarray/issues/6597#issuecomment-1124863541,https://api.github.com/repos/pydata/xarray/issues/6597,1124863541,IC_kwDOAMm_X85DDA41,22245117,2022-05-12T11:12:39Z,2022-05-12T11:12:39Z,CONTRIBUTOR,"Thanks - I think I might be misunderstanding how the new implementation works. I tried the following changes, but both of them return an error: ```python xr.polyval(values - values[0], polyfit_coefficients) ``` ``` Traceback (most recent call last): File ""/Users/mattia/MyGit/test.py"", line 31, in xr.polyval(values - values[0], polyfit_coefficients) File ""/Users/mattia/MyGit/xarray/xarray/core/computation.py"", line 1908, in polyval coord = _ensure_numeric(coord) # type: ignore # https://github.com/python/mypy/issues/1533 ? File ""/Users/mattia/MyGit/xarray/xarray/core/computation.py"", line 1949, in _ensure_numeric return to_floatable(data) File ""/Users/mattia/MyGit/xarray/xarray/core/computation.py"", line 1939, in to_floatable x.data, ValueError: cannot include dtype 'm' in a buffer ``` ```python xr.polyval(azimuth_time.coords[""azimuth_time""], polyfit_coefficients) ``` ``` Traceback (most recent call last): File ""/Users/mattia/MyGit/test.py"", line 31, in xr.polyval(azimuth_time.coords[""azimuth_time""], polyfit_coefficients) File ""/Users/mattia/MyGit/xarray/xarray/core/computation.py"", line 1908, in polyval coord = _ensure_numeric(coord) # type: ignore # https://github.com/python/mypy/issues/1533 ? File ""/Users/mattia/MyGit/xarray/xarray/core/computation.py"", line 1949, in _ensure_numeric return to_floatable(data) File ""/Users/mattia/MyGit/xarray/xarray/core/computation.py"", line 1938, in to_floatable data=datetime_to_numeric( File ""/Users/mattia/MyGit/xarray/xarray/core/duck_array_ops.py"", line 434, in datetime_to_numeric array = array - offset numpy.core._exceptions._UFuncBinaryResolutionError: ufunc 'subtract' cannot use operands with types dtype('