issues: 324758225
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
324758225 | MDU6SXNzdWUzMjQ3NTgyMjU= | 2165 | CFTimeIndex improperly handles string slice for length-1 indexes | 6628425 | closed | 0 | 0 | 2018-05-21T00:51:55Z | 2018-05-21T08:02:35Z | 2018-05-21T08:02:35Z | MEMBER | Code Sample, a copy-pastable example if possible``` In [1]: import xarray as xr In [2]: import cftime In [3]: index = xr.CFTimeIndex([cftime.DatetimeNoLeap(1, 1, 1)]) In [4]: da = xr.DataArray([1], coords=[index], dims=['time']) In [5]: da.sel(time=slice('0001', '0001')) Out[5]: <xarray.DataArray (time: 0)> array([], dtype=int64) Coordinates: * time (time) object ``` Problem descriptionWhen a In [10]: index = pd.DatetimeIndex(['2000-01-01']) In [11]: da = xr.DataArray([1], coords=[index], dims=['time']) In [12]: da.sel(time=slice('2000', '2000')) Out[12]: <xarray.DataArray (time: 1)> array([1]) Coordinates: * time (time) datetime64[ns] 2000-01-01 ``` I have a fix for this, which I will push shortly. Expected Output
Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2165/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |