home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 581914938

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/3746#issuecomment-581914938 https://api.github.com/repos/pydata/xarray/issues/3746 581914938 MDEyOklzc3VlQ29tbWVudDU4MTkxNDkzOA== 14808389 2020-02-04T13:42:41Z 2020-02-04T14:31:23Z MEMBER

the issue here is that if you call __delitem__ on DataArray.coords (which returns a dict-like object named DataArrayCoordinates), it deletes the coordinates, but leaves the indexes intact: python In [13]: arr1_ = arr1.copy() ...: del arr1_.coords["x"] ...: del arr1_.coords["y"] ...: arr1_.coords, arr1_.indexes Out[13]: (Coordinates: *empty*, y: Int64Index([0, 1], dtype='int64', name='y') x: Int64Index([0, 1], dtype='int64', name='x'))

Since #3481 the indexes are passed along in binary operations (such as multiplication) and will thus cause the coordinates reappear. Note that coordinates without indexes (non-dimension coordinates) will be removed properly.

If we want to support this way of dropping coordinates we should update the indexes, explicitly or via drop_vars, otherwise we might want to make *Coordinates objects read-only.

For now the easiest way to properly remove coordinates is by using drop_vars.

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