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/3641#issuecomment-567129939,https://api.github.com/repos/pydata/xarray/issues/3641,567129939,MDEyOklzc3VlQ29tbWVudDU2NzEyOTkzOQ==,81219,2019-12-18T17:22:55Z,2019-12-18T17:22:55Z,CONTRIBUTOR,"Note that at the moment, if we pass np.datetime64 objects that exceed the allowed time span, the function yields garbage without failing. Is this something we want to fix as well ? 

One option is to convert array and offset to microseconds first, then compute the delta, but this may break people's code. 
 ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,539648897
https://github.com/pydata/xarray/issues/3641#issuecomment-567077543,https://api.github.com/repos/pydata/xarray/issues/3641,567077543,MDEyOklzc3VlQ29tbWVudDU2NzA3NzU0Mw==,81219,2019-12-18T15:22:07Z,2019-12-18T15:22:07Z,CONTRIBUTOR,"How about replacing 
`array = np.asarray(pd.Series(array.ravel())).reshape(array.shape)`
by 
`array = array.astype(""timedelta64"")`
?
with numpy 1.17 your example works and the test suite only fails on unrelated netcdf string errors. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,539648897
https://github.com/pydata/xarray/issues/3641#issuecomment-567022752,https://api.github.com/repos/pydata/xarray/issues/3641,567022752,MDEyOklzc3VlQ29tbWVudDU2NzAyMjc1Mg==,81219,2019-12-18T13:04:31Z,2019-12-18T13:04:31Z,CONTRIBUTOR,"Got it, thanks ! ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,539648897
https://github.com/pydata/xarray/issues/3641#issuecomment-567018062,https://api.github.com/repos/pydata/xarray/issues/3641,567018062,MDEyOklzc3VlQ29tbWVudDU2NzAxODA2Mg==,81219,2019-12-18T12:49:43Z,2019-12-18T12:49:43Z,CONTRIBUTOR,"Another issue with `datetime_to_numeric` happens with: 
```
import xarray as xr
import cftime
i = xr.CFTimeIndex(xr.cftime_range('2000-01-01', periods=2))
xr.core.duck_array_ops.datetime_to_numeric(i, cftime.DatetimeGregorian(2, 1, 1), datetime_unit='D')
```


```python
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.array_to_timedelta64()

pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.parse_timedelta_string()

TypeError: object of type 'datetime.timedelta' has no len()

During handling of the above exception, another exception occurred:

OverflowError                             Traceback (most recent call last)
<ipython-input-50-b03d9c4f220d> in <module>
----> 1 xr.core.duck_array_ops.datetime_to_numeric(i, cftime.DatetimeGregorian(2, 1, 1), datetime_unit='D')

~/src/xarray/xarray/core/duck_array_ops.py in datetime_to_numeric(array, offset, datetime_unit, dtype)
    395         else:
    396             offset = min(array)
--> 397     array = array - offset
    398 
    399     if not hasattr(array, ""dtype""):  # scalar is converted to 0d-array

~/src/xarray/xarray/coding/cftimeindex.py in __sub__(self, other)
    431 
    432         if isinstance(other, (CFTimeIndex, cftime.datetime)):
--> 433             return pd.TimedeltaIndex(np.array(self) - np.array(other))
    434         elif isinstance(other, pd.TimedeltaIndex):
    435             return CFTimeIndex(np.array(self) - other.to_pytimedelta())

~/.conda/envs/xclim3/lib/python3.6/site-packages/pandas/core/indexes/timedeltas.py in __new__(cls, data, unit, freq, start, end, periods, closed, dtype, copy, name, verify_integrity)
    256 
    257         tdarr = TimedeltaArray._from_sequence(
--> 258             data, freq=freq, unit=unit, dtype=dtype, copy=copy
    259         )
    260         return cls._simple_new(tdarr._data, freq=tdarr.freq, name=name)

~/.conda/envs/xclim3/lib/python3.6/site-packages/pandas/core/arrays/timedeltas.py in _from_sequence(cls, data, dtype, copy, freq, unit)
    270         freq, freq_infer = dtl.maybe_infer_freq(freq)
    271 
--> 272         data, inferred_freq = sequence_to_td64ns(data, copy=copy, unit=unit)
    273         freq, freq_infer = dtl.validate_inferred_freq(freq, inferred_freq, freq_infer)
    274 

~/.conda/envs/xclim3/lib/python3.6/site-packages/pandas/core/arrays/timedeltas.py in sequence_to_td64ns(data, copy, unit, errors)
    971     if is_object_dtype(data.dtype) or is_string_dtype(data.dtype):
    972         # no need to make a copy, need to convert if string-dtyped
--> 973         data = objects_to_td64ns(data, unit=unit, errors=errors)
    974         copy = False
    975 

~/.conda/envs/xclim3/lib/python3.6/site-packages/pandas/core/arrays/timedeltas.py in objects_to_td64ns(data, unit, errors)
   1096     values = np.array(data, dtype=np.object_, copy=False)
   1097 
-> 1098     result = array_to_timedelta64(values, unit=unit, errors=errors)
   1099     return result.view(""timedelta64[ns]"")
   1100 

pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.array_to_timedelta64()

pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.convert_to_timedelta64()

pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.delta_to_nanoseconds()

OverflowError: Python int too large to convert to C long
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,539648897