home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 1146877063

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/3925#issuecomment-1146877063 https://api.github.com/repos/pydata/xarray/issues/3925 1146877063 IC_kwDOAMm_X85EW_SH 5347026 2022-06-05T20:18:26Z 2022-06-05T20:18:26Z NONE

In #5692 it is possible to perform selection using non-dimension coordinates with an index, although there's no easy way yet to set an index for such coordinates (this will be done in a follow-up PR by updating the API of set_index).

@benbovy, please could you give an example how it is possible? I would like sel based on a non-dim coordinate to be as fast as sel based on the dim itself as per the following timings: ```python

sel based on a non-dim coordinate

(using this coordinate directly .sel(product_id=26) would result in error "'no index found for coordinate product_id")

%timeit xds.sel(product=xds.product_id==26) 1.54 ms ± 64.2 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

sel based on the dim itself

%timeit xds.sel(product='GN91 Glove Medium') 499 µs ± 16.1 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

%timeit xds.where(xds.product_id==26, drop=True) 4.17 ms ± 39 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  592312709
Powered by Datasette · Queries took 0.815ms · About: xarray-datasette