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/2213#issuecomment-544864012,https://api.github.com/repos/pydata/xarray/issues/2213,544864012,MDEyOklzc3VlQ29tbWVudDU0NDg2NDAxMg==,206773,2019-10-22T08:46:46Z,2019-10-22T12:09:10Z,NONE,"> @hans-permana your example shows a different issue: indexing with a date string yields a time dimension of length 1, rather than squeezing it out
Nope, look at the screenshot again, the dimension is zero. The very similar issue (if not same) remains and should be considered a bug:

If I now use `sel()` with a date string without time component, I get a 3D array with zero time dimension:

However, if I use `sel()` with a date string *with* time component, I get the expected 2D array:

**EDIT**
It seems that if I create the `cube` dataset from above with a `time` coordinate variable whose values don't have a time component (e.g. `2018-06-26 00:00:00.000000`), then both `sel(time='2018-06-26')` and `sel(time='2018-06-26 10:23:05')` work as expected and only yield 2D results.
**EDIT 2**
Root cause may be related to Pandas indexing using strings that encode different accuracy / resolution: http://pandas-docs.github.io/pandas-docs-travis/user_guide/timeseries.html#slice-vs-exact-match. Very contra-intuitive.
#### Output of ``xr.show_versions()``
python: 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 22:01:29) [MSC v.1900 64 bit (AMD64)]
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 26 Stepping 5, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
libhdf5: 1.10.4
libnetcdf: 4.6.2
xarray: 0.14.0
pandas: 0.25.2
numpy: 1.16.4
scipy: 1.2.1
netCDF4: 1.5.0.1
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.3.2
cftime: 1.0.3.4
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.0.22
cfgrib: None
iris: None
bottleneck: None
dask: 2.6.0
distributed: 2.6.0
matplotlib: 3.0.3
cartopy: None
seaborn: None
numbagg: None
setuptools: 41.0.1
pip: 19.0.3
conda: None
pytest: 4.4.2
IPython: 7.4.0
sphinx: 2.0.1
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,329066551
https://github.com/pydata/xarray/issues/2213#issuecomment-394763540,https://api.github.com/repos/pydata/xarray/issues/2213,394763540,MDEyOklzc3VlQ29tbWVudDM5NDc2MzU0MA==,1217238,2018-06-05T15:55:41Z,2018-06-05T15:55:41Z,MEMBER,"@hans-permana your example shows a different issue: indexing with a date string yields a time dimension of length 1, rather than squeezing it out (as is the case for datetime strings). This behavior is actually expected/consistent with pandas, although I agree that it is surprising.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,329066551
https://github.com/pydata/xarray/issues/2213#issuecomment-394718239,https://api.github.com/repos/pydata/xarray/issues/2213,394718239,MDEyOklzc3VlQ29tbWVudDM5NDcxODIzOQ==,7643370,2018-06-05T13:55:30Z,2018-06-05T13:55:30Z,NONE,"@shoyer I created a [notebook ](https://github.com/esa-esdl/esdl-core/blob/master/notebooks/xarray_2213.ipynb) to reproduce this issue with self-contained dummy data and I think I know when this issue occurs.
In both cases (my original application and in the notebook example), the time dimension of the DataArray comes with time. When selecting it using **_.sel_**, when time is specified with date and time, the returned DataArray is rightly 2D. However, when the time selection includes only the date (when calling xarray.Dataset.sel), the return includes an unexpected time dimension. In the notebook example, the time dimension is 1 because it could find the right date whereas in my application, time dimension is 0 because it could not find the queried date. I am not sure what is the expected behaviour here.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,329066551
https://github.com/pydata/xarray/issues/2213#issuecomment-394441450,https://api.github.com/repos/pydata/xarray/issues/2213,394441450,MDEyOklzc3VlQ29tbWVudDM5NDQ0MTQ1MA==,1217238,2018-06-04T17:50:38Z,2018-06-04T17:50:38Z,MEMBER,"At first glance, this does look broken. Can you reproduce this with self-contained dummy data? see
http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,329066551
https://github.com/pydata/xarray/issues/2213#issuecomment-394371429,https://api.github.com/repos/pydata/xarray/issues/2213,394371429,MDEyOklzc3VlQ29tbWVudDM5NDM3MTQyOQ==,7643370,2018-06-04T14:19:29Z,2018-06-04T14:19:29Z,NONE,"@jhamman - yes I can reproduce this also in 0.10.6.
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 63 Stepping 2, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
xarray: 0.10.6
pandas: 0.19.0
numpy: 1.11.3
scipy: 1.1.0
netCDF4: 1.2.2
h5netcdf: 0.2.2
h5py: 2.6.0
Nio: None
zarr: None
bottleneck: 1.2.1
cyordereddict: 1.0.0
dask: 0.14.1
distributed: 1.21.8
matplotlib: 2.2.2
cartopy: None
seaborn: 0.8.1
setuptools: 27.2.0.post20161106
pip: 9.0.1
conda: None
pytest: 3.6.0
IPython: 6.4.0
sphinx: None
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,329066551
https://github.com/pydata/xarray/issues/2213#issuecomment-394366104,https://api.github.com/repos/pydata/xarray/issues/2213,394366104,MDEyOklzc3VlQ29tbWVudDM5NDM2NjEwNA==,2443309,2018-06-04T14:03:58Z,2018-06-04T14:03:58Z,MEMBER,@hans-permana - thank you for the report. Can you try to reproduce this behavior with xarray version 0.10.6 (released last week)?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,329066551