issues: 819897789
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
819897789 | MDU6SXNzdWU4MTk4OTc3ODk= | 4983 | Date missing in datetime accessor | 43613877 | closed | 0 | 4 | 2021-03-02T10:52:00Z | 2021-03-16T10:00:23Z | 2021-03-16T10:00:23Z | CONTRIBUTOR | What happened:
I wonder if there is a reason, why there is no What you expected to happen:
As the Minimal Complete Verifiable Example: ```python import xarray as xr import pandas as pd time_coord = pd.date_range("2020-01-01","2020-01-03", freq="12H") da = xr.DataArray([1,2,3,4,5], dims=["time"], coords={'time': time_coord}) print(da.time.dt.time) <xarray.DataArray 'time' (time: 5)>array([datetime.time(0, 0), datetime.time(12, 0), datetime.time(0, 0),datetime.time(12, 0), datetime.time(0, 0)], dtype=object)Coordinates:* time (time) datetime64[ns] 2020-01-01 2020-01-01T12:00:00 ... 2020-01-03print(da.time.dt.date) ---------------------------------------------------------------------------AttributeError Traceback (most recent call last)<ipython-input-42-13741f407661> in <module>----> 1 da.time.dt.dateAttributeError: 'DatetimeAccessor' object has no attribute 'date'``` Suggestion:
A simple addition of
Anything else we need to know?: Environment: Output of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.8.6 | packaged by conda-forge | (default, Oct 7 2020, 19:08:05) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 2.6.32-754.33.1.el6.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.17.0 pandas: 1.2.1 numpy: 1.20.0 scipy: 1.6.0 netCDF4: 1.5.5.1 pydap: None h5netcdf: None h5py: None Nio: None zarr: 2.6.1 cftime: 1.4.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2021.02.0 distributed: 2021.02.0 matplotlib: 3.3.4 cartopy: 0.18.0 seaborn: 0.11.1 numbagg: None pint: 0.16.1 setuptools: 49.6.0.post20210108 pip: 21.0.1 conda: None pytest: None IPython: 7.20.0 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/4983/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |