issues: 778123296
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
778123296 | MDExOlB1bGxSZXF1ZXN0NTQ4MjY4ODg5 | 4762 | Print number of variables in repr | 14371165 | closed | 0 | 6 | 2021-01-04T14:13:17Z | 2021-05-18T18:17:50Z | 2021-01-12T00:21:19Z | MEMBER | 0 | pydata/xarray/pulls/4762 | Show the printed and total number of variables in the repr.
```python import numpy as np import xarray as xr a = np.arange(0, 15) b = np.core.defchararray.add("long_variable_name", a.astype(str)) c = np.arange(0, 25) d = np.core.defchararray.add("attr_", c.astype(str)) e = {k: 2 for k in d} coords = dict(time=da.array([0, 1])) data_vars = dict() for v in b: data_vars[v] = xr.DataArray( name=v, data=np.array([0, 1]).astype(bool), dims=["time"], coords=coords, ) ds1 = xr.Dataset(data_vars) ds1.attrs = e The repr now shows how many attributes in total there are:print(ds1) Out[10]: <xarray.Dataset> Dimensions: (time: 2) Coordinates: * time (time) int32 0 1 Data variables: (12/15) long_variable_name0 (time) bool False True long_variable_name1 (time) bool False True long_variable_name2 (time) bool False True long_variable_name3 (time) bool False True long_variable_name4 (time) bool False True long_variable_name5 (time) bool False True ... long_variable_name9 (time) bool False True long_variable_name10 (time) bool False True long_variable_name11 (time) bool False True long_variable_name12 (time) bool False True long_variable_name13 (time) bool False True long_variable_name14 (time) bool False True Attributes: (12/25) attr_0: 2 attr_1: 2 attr_2: 2 attr_3: 2 attr_4: 2 attr_5: 2 ... attr_19: 2 attr_20: 2 attr_21: 2 attr_22: 2 attr_23: 2 attr_24: 2 ``` |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/4762/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | pull |