home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

1 row where state = "open", type = "issue" and user = 43635101 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

type 1

  • issue · 1 ✖

state 1

  • open · 1 ✖

repo 1

  • xarray 1
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
1180565228 I_kwDOAMm_X85GXf7s 6412 numpy datetime conversion with DataArray is not working jules-ch 43635101 open 0     3 2022-03-25T09:46:12Z 2022-03-29T14:22:11Z   NONE      

What happened?

I have a simple DataArray with datetime[ns] inside, but when I try to convert this to a supported numpy datetime dtype, the results is still a datetime[ns].

Using the values attribute & converting it, returns the correct results

What did you expect to happen?

I excpected the DataArray to be converted in the correct dtype

Minimal Complete Verifiable Example

```Python

time = pd.date_range('2015-01-01 00:00:00', '2015-12-31 23:59:00', inclusive='left', freq='15min') da = xr.DataArray(time) da <xarray.DataArray (dim_0: 35040)> array(['2015-01-01T00:00:00.000000000', '2015-01-01T00:15:00.000000000', '2015-01-01T00:30:00.000000000', ..., '2015-12-31T23:15:00.000000000', '2015-12-31T23:30:00.000000000', '2015-12-31T23:45:00.000000000'], dtype='datetime64[ns]') Coordinates: * dim_0 (dim_0) datetime64[ns] 2015-01-01 ... 2015-12-31T23:45:00

da.astype("datetime64[Y]") <xarray.DataArray (dim_0: 35040)> array(['2015-01-01T00:00:00.000000000', '2015-01-01T00:00:00.000000000', '2015-01-01T00:00:00.000000000', ..., '2015-01-01T00:00:00.000000000', '2015-01-01T00:00:00.000000000', '2015-01-01T00:00:00.000000000'], dtype='datetime64[ns]') Coordinates: * dim_0 (dim_0) datetime64[ns] 2015-01-01 ... 2015-12-31T23:45:00 da.values.astype("datetime64[Y]") array(['2015', '2015', '2015', ..., '2015', '2015', '2015'], dtype='datetime64[Y]') ```

Relevant log output

No response

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS

commit: None python: 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] python-bits: 64 OS: Linux OS-release: 5.13.0-37-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.1 libnetcdf: None

xarray: 0.20.2 pandas: 1.4.1 numpy: 1.22.3 scipy: 1.8.0 netCDF4: None pydap: None h5netcdf: None h5py: 3.6.0 Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2022.03.0 distributed: 2022.3.0 matplotlib: 3.5.1 cartopy: None seaborn: None numbagg: None fsspec: 2022.02.0 cupy: None pint: 0.18 sparse: None setuptools: 60.6.0 pip: 22.0.3 conda: None pytest: 6.2.5 IPython: 8.1.1 sphinx: None

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6412/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 38.041ms · About: xarray-datasette