home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1438647770

This data as json

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/7546#issuecomment-1438647770 https://api.github.com/repos/pydata/xarray/issues/7546 1438647770 IC_kwDOAMm_X85VwAXa 14808389 2023-02-21T15:09:43Z 2023-02-21T15:09:43Z MEMBER

Could you post the output you get? If I try it locally, I get: python In [3]: import xarray as xr ...: import pandas as pd ...: import numpy as np ...: ...: da = xr.DataArray( ...: np.array([1, 2, 3, 1, 2, np.nan]), ...: dims="time", ...: coords=dict( ...: time=("time", pd.date_range("01-01-2001", freq="M", periods=6)), ...: labels=("time", np.array(["a", "b", "c", "c", "b", "a"])), ...: ), ...: ) ...: da.labels.attrs["units"] = "a.u." ...: ...: ds = xr.Dataset(dict(da=da)) ...: ds.attrs["units"] = "V" ...: display(ds) ...: ...: m = ds.groupby("labels").mean(keep_attrs=True) ...: display(m) ...: display(m.labels) # labels has attribute for units <xarray.Dataset> Dimensions: (time: 6) Coordinates: * time (time) datetime64[ns] 2001-01-31 2001-02-28 ... 2001-06-30 labels (time) <U1 'a' 'b' 'c' 'c' 'b' 'a' Data variables: da (time) float64 1.0 2.0 3.0 1.0 2.0 nan Attributes: units: V <xarray.Dataset> Dimensions: (labels: 3) Coordinates: * labels (labels) object 'a' 'b' 'c' Data variables: da (labels) float64 1.0 2.0 2.0 Attributes: units: V <xarray.DataArray 'labels' (labels: 3)> array(['a', 'b', 'c'], dtype=object) Coordinates: * labels (labels) object 'a' 'b' 'c' Attributes: units: a.u. which looks fine to me? But maybe I'm missing something?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1593602847
Powered by Datasette · Queries took 80.822ms · About: xarray-datasette