home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1301237961

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
1301237961 PR_kwDOAMm_X847OKqc 6774 Make the `sel` error more descriptive when `method` is unset 4806877 closed 0     1 2022-07-11T21:17:07Z 2022-07-13T14:49:24Z 2022-07-12T20:33:00Z CONTRIBUTOR   0 pydata/xarray/pulls/6774
  • [x] Tests added

This came up in the tutorial and I was wondering if the error could be made a little clearer. Not sure if the error message should hint that a user might want to use method.

```python import numpy as np import pandas as pd import xarray as xr

arr = xr.DataArray( data=np.arange(48).reshape(4, 2, 6), dims=("u", "v", "time"), coords={ "u": [-3.2, 2.1, 5.3, 6.5], "v": [-1, 2.6], "time": pd.date_range("2009-01-05", periods=6, freq="M"), }, ) arr.sel(u=5, time="2009-04-28") # I removed method="nearest" ```

Before this PR:

python-traceback ... KeyError: 5.0

After this PR:

python-traceback ... KeyError: "not all values found in index 'u'. Did you mean to set `method=`?"

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

Links from other tables

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