Skip to content

raise an error for assign_coords({Hashable: xr.Coordinates}) #10194

Open
@dcherian

Description

@dcherian

What happened?

This works but is wrong.

import xarray as xr
from xarray.indexes import RangeIndex

ds = xr.Dataset({"foo": ("x", [1, 2, 3])})
coords = xr.Coordinates.from_xindex(RangeIndex.arange("x", "x", 1.5, 4.5, 1.0))
ds.assign_coords({"x": coords})

What did you expect to happen?

We should error and tell the user to use ds.assign_coords(coords) instead

xref efe3e81#r2019841034

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions