home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 391932929

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/issues/2180#issuecomment-391932929 https://api.github.com/repos/pydata/xarray/issues/2180 391932929 MDEyOklzc3VlQ29tbWVudDM5MTkzMjkyOQ== 1217238 2018-05-25T03:46:40Z 2018-05-25T03:46:40Z MEMBER

Looking at @crusaderky's example of different coordinate labels again, I finally remember why it works this way.

The logic of ds.update(other) is that (1) variables explicitly listed in other should take precedence over the original object and (2) mutating a Dataset should not change its dimensions or indexes.

This is pretty clearly expressed in the original code: return merge_core([dataset, other], priority_arg=1, indexes=dataset.indexes)

In @crusaderky's example with fridge.update(shopping), shopping first gets reindexed to fridge (which means it ends up only holding NaN), and is then used to override the original dataset: <xarray.Dataset> Dimensions: (fruit: 1) Coordinates: * fruit (fruit) object 'apples' quality (fruit) object nan Data variables: fruits (fruit) float64 nan It would probably make sense to keep values from the original variables rather than blindly replacing them with the new NaNs from shopping, but in general I do think the general approach of "right join on variables" and "left join on indexes" makes sense for update().

For most use cases, the true outer join makes more sense -- which is why xarray.merge() works that way.

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