home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 482452409

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
482452409 MDU6SXNzdWU0ODI0NTI0MDk= 3231 Dict-like argument support for assign_coords() 2818208 closed 0     3 2019-08-19T18:07:39Z 2019-09-28T20:44:08Z 2019-09-28T20:44:08Z CONTRIBUTOR      

Often the xarray API supports either a dict or kwargs, and it seems like this should be consistent as often as possible. With assign_coords, this works as expected:

```python

dims = ["x", "y"] coords = {"fruit": ("x", ["apple", "banana"])} arr = xr.DataArray([[1,2,3],[4,5,6]], dims=dims, coords=coords) arr.assign_coords(color=("x", ["red", "yellow"])) <xarray.DataArray (x: 2, y: 3)> array([[1, 2, 3], [4, 5, 6]]) Coordinates: fruit (x) <U6 'apple' 'banana' color (x) <U6 'red' 'yellow' Dimensions without coordinates: x, y ```

Since assign_coords works with keyword arguments, I would expect it to also work with a dict, similar to sel, drop, etc. But it does not:

```python

arr.assign_coords({"color": ("x", ["red", "yellow"])}) *** TypeError: assign_coords() takes 1 positional argument but 2 were given ```

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

  • 2 rows from issues_id in issues_labels
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 0.541ms · About: xarray-datasette