home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 805389572 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 2

  • dschwoerer 1
  • keewis 1

author_association 2

  • CONTRIBUTOR 1
  • MEMBER 1

issue 1

  • Dataset.mean changes variables without specified dimension · 2 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
788052130 https://github.com/pydata/xarray/issues/4885#issuecomment-788052130 https://api.github.com/repos/pydata/xarray/issues/4885 MDEyOklzc3VlQ29tbWVudDc4ODA1MjEzMA== dschwoerer 5637662 2021-03-01T15:47:52Z 2021-03-01T15:47:52Z CONTRIBUTOR

I tried this: diff --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -4701,7 +4701,9 @@ class Dataset(Mapping, ImplementsDatasetReduce, DataWithCoords): if not reduce_dims: variables[name] = var else: - if ( + if not reduce_dims: + variables[name] = var + elif ( not numeric_only or np.issubdtype(var.dtype, np.number) or (var.dtype == np.bool_) which works great for mean - "var" stays an integer, as expected.

However, that breaks ds.std - which should be zero for "var", but isn't. I guess that is ok for coords - as the assumption is that on coordinates the calculation is not done, but for data variables this is probably not ok.

```diff --- a/xarray/core/duck_array_ops.py +++ b/xarray/core/duck_array_ops.py @@ -537,6 +537,11 @@ def mean(array, axis=None, skipna=None, **kwargs): dtypes""" from .common import _contains_cftime_datetimes

  • The mean over an empty axis shouldn't change the data

  • See https://github.com/pydata/xarray/issues/4885

  • if not axis:
  • return array + array = asarray(array) if array.dtype.kind in "Mm": offset = _datetime_nanmin(array) ``` I think it is best to change mean - which would work also for dataArrays. This implies that mean does not convert to float64 - as the numpy version does, but I guess that should be fine.

Should I open a PR?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Dataset.mean changes variables without specified dimension 805389572
778694834 https://github.com/pydata/xarray/issues/4885#issuecomment-778694834 https://api.github.com/repos/pydata/xarray/issues/4885 MDEyOklzc3VlQ29tbWVudDc3ODY5NDgzNA== keewis 14808389 2021-02-13T23:48:24Z 2021-02-13T23:48:24Z MEMBER

the code that controls this is here: https://github.com/pydata/xarray/blob/f3f0a14b2e5e3de3d5f1e7515ee8f9b751ca8fd2/xarray/core/dataset.py#L4676-L4702

We could easily skip processing if not reduce_dims for data variables, too. Does anyone know why only coords are skipped?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Dataset.mean changes variables without specified dimension 805389572

Advanced export

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

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 13.944ms · About: xarray-datasette