home / github / pull_requests

Menu
  • Search all tables
  • GraphQL API

pull_requests: 1007054529

This data as json

id node_id number state locked title user body created_at updated_at closed_at merged_at merge_commit_sha assignee milestone draft head base author_association auto_merge repo url merged_by
1007054529 PR_kwDOAMm_X848Bm7B 6823 closed 0 Rely on array backend for string formatting 14371165 * Rely on array backend for string formatting instead of forcing to numpy arrays. The previous implementation used `.values` to force to numpy arrays which doesn't work for sparse arrays and might be scary in the case of large dask arrays. * Only allow `format_spec` when dealing with scalar arrays, shape=(). Using f-strings is a common method to print the repr. If we want to have full support of `.__format__` we should probably add `format_spec` as input to `formatting.array_repr`. - [x] Closes #6822 - [x] Tests added - [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst` ```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,). ``` 2022-07-25T09:43:21Z 2022-08-08T15:11:34Z 2022-08-08T15:11:34Z 2022-08-08T15:11:34Z c3d45b3adf1ae82067b279c2226e076e2fbb53e6     0 49b1c245a3e021c0763fee5f9c617a9212a785c7 a17a00f8f95195838e1d7360426454c8ed0570ea MEMBER   13221727 https://github.com/pydata/xarray/pull/6823  

Links from other tables

  • 1 row from pull_requests_id in labels_pull_requests
Powered by Datasette · Queries took 0.838ms