issue_comments: 1200289273
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/pull/6823#issuecomment-1200289273 | https://api.github.com/repos/pydata/xarray/issues/6823 | 1200289273 | IC_kwDOAMm_X85HivX5 | 14371165 | 2022-07-30T20:31:01Z | 2022-07-30T20:31:01Z | MEMBER | This is how it behaves right now. I believe this should be the same behavior as previously now with the extra possibility to format scalar arrays: ```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,). ``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1316549018 |