issues: 1316549018
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1316549018 | PR_kwDOAMm_X848Bm7B | 6823 | Rely on array backend for string formatting | 14371165 | closed | 0 | 5 | 2022-07-25T09:43:21Z | 2022-08-08T15:11:34Z | 2022-08-08T15:11:34Z | MEMBER | 0 | pydata/xarray/pulls/6823 |
```python import pandas as pd import xarray as xr s = pd.Series( range(4), index=pd.MultiIndex.from_product([list("ab"), list("cd")]), ) da = xr.DataArray.from_series(s, sparse=True) Handle sparse:print(f"Error: {da} is sparse") Error: <xarray.DataArray (level_0: 2, level_1: 2)> <COO: shape=(2, 2), dtype=float64, nnz=4, fill_value=nan> Coordinates: * level_0 (level_0) object 'a' 'b' * level_1 (level_1) object 'c' 'd' is sparse Handle format_spec:da = xr.DataArray([1, 2, 3]) print(f'{da[0]}') <xarray.DataArray ()> array(1) print(f'{da[0]:d}') 1 print(f'{da[0]:f}') 1.000000 da = xr.DataArray([1, 2, 3]) print(f'{da:.f}') Traceback (most recent call last): (...) NotImplementedError: Using format_spec is only supported when shape is (). Got shape = (3,). ``` |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/6823/reactions", "total_count": 1, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 1, "rocket": 0, "eyes": 0 } |
13221727 | pull |