home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 527237590

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
527237590 MDU6SXNzdWU1MjcyMzc1OTA= 3562 Minimize `.item()` call 6815844 open 0     1 2019-11-22T14:44:43Z 2023-06-08T04:48:50Z   MEMBER      

MCVE Code Sample

I want to minimize the number of calls .item() within my data analysis. It often happens

  1. when putting a 0d-DataArray into a slice python da = xr.DataArray([0.5, 4.5, 2.5], dims=['x'], coords={'x': [0, 1, 2]}) da[: da.argmax()] -> TypeError: 'DataArray' object cannot be interpreted as an integer

  2. when using a 0d-DataArray for selecting python da = xr.DataArray([0.5, 4.5, 2.5], dims=['x'], coords={'x': [0, 0, 2]}) da.sel(x=da['x'][0]) -> IndexError: arrays used as indices must be of integer (or boolean) type

Both cases, I need to call '.item()'. It is not a big issue, but I think it would be nice if xarray becomes more self-contained.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3562/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.621ms · About: xarray-datasette