home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 184327428

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
184327428 MDU6SXNzdWUxODQzMjc0Mjg= 1054 API: are indexes public API? 1924092 closed 0     1 2016-10-20T20:06:47Z 2016-10-22T00:29:41Z 2016-10-22T00:29:41Z MEMBER      

Usecase - I have a DataArray that will be passed into a numba function and need to pass in some slices. Very simplified example:

``` python from numba import njit @njit def f(arr, slc1, slc2): return arr[slc1].max() - arr[slc2].min()

da = xr.DataArray([1., 2., 3.], coords={'key': ['a', 'b', 'c']}) ```

Right now I'm accessing the underlying indexes to get slices, like so:

``` python f(da.values, da.indexes['key'].slice_indexer('a', 'b'), da.indexes['key'].slice_indexer('c', 'c'))

Out[52]: -1.0 ```

First question, am I missing some obviously better way to do this? Of course in this example I could just pass in sliced values, but in my actual usecase the data has higher dimensions and I use the slice multiple times across multiple arrays.

More broadly, should the underlying indexes be thought of as an implementation detail (e.g. could be swapped out with something else) or is it more-or-less an API guarantee that I'll get a pandas Index here?

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

Links from other tables

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