home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1624560934

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
1624560934 I_kwDOAMm_X85g1NUm 7630 .loc[] cannot find a value that .sel() can find without problem 90059220 closed 0     6 2023-03-15T01:26:32Z 2023-04-28T13:09:22Z 2023-04-28T13:09:22Z NONE      

What is your issue?

Hi all, Given the minimal working example bellow:

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

nc = xr.DataArray([[0]], dims=["x", "y"], coords=dict( lon=(["x"], [1]), lat=(["y"], [1])))

times_ = pd.date_range('2020-01-01', '2022-01-01', freq='1d') dt = times_[0] nc = nc.expand_dims(time=times_)

nc.sel(time=dt) nc.loc['time' == dt]

```

The nc.sel() part works like a charm, but the nc.loc[] return KeyError: "not all values found in index 'time'. Try setting the 'method' keyword argument (example: method='nearest').". Any idea what is happening there ? Considering I want to be able to edit the values of nc for certain sets of [x,y,time], my understanding is that I have to use loc[]. But it does not find the value dt whereas sel() does. How can I solve that ?

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7630/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

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