pull_requests: 1557590401
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1557590401 | PR_kwDOAMm_X85c1vGB | 8315 | closed | 0 | Handle numpy missing the array api function astype | 14371165 | This is how our get_array_namespace works: https://github.com/pydata/xarray/blob/dafd726c36e24ac77427513a4a149a6933353b66/xarray/core/duck_array_ops.py#L44-L48 Which usually works. But not for astype. Using np.array_api doesn't work because you have to use np.array_api.Array instead of np.ndarray: ```python import numpy.array_api as nxp nxp.astype(np.array([1, 2,]), np.dtype(float)) Traceback (most recent call last): File "C:\Users\J.W\AppData\Local\Temp\ipykernel_8616\23329947.py", line 1, in <cell line: 1> nxp.astype(np.array([1, 2,]), np.dtype(float)) File "C:\Users\J.W\anaconda3\envs\xarray-tests\lib\site-packages\numpy\array_api\_data_type_functions.py", line 20, in astype return Array._new(x._array.astype(dtype=dtype, copy=copy)) AttributeError: 'numpy.ndarray' object has no attribute '_array' ``` I found it simpler to just change astype here. An alternative solution would be to use: https://github.com/data-apis/array-api-compat https://github.com/tomwhite/cubed/pull/317 Seen in #8294. | 2023-10-15T22:32:17Z | 2023-10-16T06:25:20Z | 2023-10-16T06:25:19Z | 2023-10-16T06:25:19Z | 4520ce9e30425bc48ac5d5c3613f638f9bf9390a | 0 | b957b8d4d74eff42ec474d652380e817d26828a6 | dafd726c36e24ac77427513a4a149a6933353b66 | MEMBER | 13221727 | https://github.com/pydata/xarray/pull/8315 |
Links from other tables
- 1 row from pull_requests_id in labels_pull_requests