issues: 319329850
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
319329850 | MDU6SXNzdWUzMTkzMjk4NTA= | 2097 | Variable.__setitem__ coercing types on objects with a values property | 1332402 | closed | 0 | 4 | 2018-05-01T21:12:45Z | 2021-02-18T15:04:14Z | 2021-02-18T15:04:14Z | NONE | Minimal example```python import xarray as xr good_indexed, bad_indexed = xr.DataArray([None]), xr.DataArray([None]) class HasValues(object): values = 5 good_indexed.loc[{'dim_0': 0}] = set() bad_indexed.loc[{'dim_0': 0}] = HasValues() correctgood_indexed.values => array([set()], dtype=object)incorrectbad_indexed.values => array([array(5)], dtype=object)``` Problem descriptionThe current behavior prevents storing objects inside arrays of The use case I had in prior versions was to store Expected OutputIdeally: ``` ... bad_indexed.values => array([< main.HasValues instance>], dtype=object)``` Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2097/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |