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/2127#issuecomment-388887212,https://api.github.com/repos/pydata/xarray/issues/2127,388887212,MDEyOklzc3VlQ29tbWVudDM4ODg4NzIxMg==,1217238,2018-05-14T16:53:54Z,2018-05-14T16:53:54Z,MEMBER,"Yes, let's use `pd.to_timedelta`. Please mention https://github.com/numpy/numpy/issues/11096 in a comment in the code -- hopefully this should be fixed in the next NumPy release (1.15?).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,322591813
https://github.com/pydata/xarray/issues/2127#issuecomment-388694419,https://api.github.com/repos/pydata/xarray/issues/2127,388694419,MDEyOklzc3VlQ29tbWVudDM4ODY5NDQxOQ==,1217238,2018-05-14T04:32:43Z,2018-05-14T04:32:43Z,MEMBER,"Any multiple of 7 days (one week) seems to trigger it, e.g.,
```
In [133]: np.array([datetime.timedelta(7)], dtype='timedelta64[D]')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 np.array([datetime.timedelta(7)], dtype='timedelta64[D]')
TypeError: Cannot cast datetime.timedelta object from metadata [Y] to [D] according to the rule 'same_kind'
```
For now, maybe try casting each element individually to `np.timedelta64` as a work-around? e.g.,
```
In [139]: np.array([np.timedelta64(d, 'ns') for d in uniques.tolist()])
Out[139]:
array([2419200000000000, 2592000000000000, 2678400000000000],
dtype='timedelta64[ns]')
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,322591813
https://github.com/pydata/xarray/issues/2127#issuecomment-388690389,https://api.github.com/repos/pydata/xarray/issues/2127,388690389,MDEyOklzc3VlQ29tbWVudDM4ODY5MDM4OQ==,1217238,2018-05-14T03:59:07Z,2018-05-14T03:59:07Z,MEMBER,"This must be a NumPy bug. Here's an even simpler reproduction:
```
import numpy as np
import datetime
np.array([datetime.timedelta(28)], dtype='timedelta64[D]')
# TypeError: Cannot cast datetime.timedelta object from metadata [Y] to [D] according to the rule 'same_kind'
```
Any other day I've tried works. Also, the following code works (at least on my laptop):
```
In [113]: np.array([datetime.timedelta(27)], dtype='timedelta64[D]'), np.array([datetime.timedelta(28)], dtype='timedelta64[D]')
Out[113]: (array([27], dtype='timedelta64[D]'), array([28], dtype='timedelta64[D]'))
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,322591813
https://github.com/pydata/xarray/issues/2127#issuecomment-388660865,https://api.github.com/repos/pydata/xarray/issues/2127,388660865,MDEyOklzc3VlQ29tbWVudDM4ODY2MDg2NQ==,1217238,2018-05-13T22:35:19Z,2018-05-13T22:35:19Z,MEMBER,"I haven't looked into this in detail, but my guess is that this is somehow related to NumPy refusing to convert a timedelta that includes years or months into nanoseconds, because years and months can have different numbers of days.
To help debug this, it would be helpful to know exactly what the input `dates` is.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,322591813