home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1862912829

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
1862912829 PR_kwDOAMm_X85Yk15B 8102 Add `Coordinates.assign()` method 4160723 closed 0     0 2023-08-23T09:15:51Z 2023-09-01T13:28:16Z 2023-09-01T13:28:16Z MEMBER   0 pydata/xarray/pulls/8102
  • [x] Tests added
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [x] New functions/methods are listed in api.rst

This is consistent with the Dataset and DataArray assign methods (now that Coordinates is also exposed as public API).

This allows writing:

```python midx = pd.MultiIndex.from_arrays([["a", "a", "b", "b"], [0, 1, 0, 1]]) midx_coords = xr.Coordinates.from_pandas_multiindex(midx, "x")

ds = xr.Dataset(coords=midx_coords.assign(y=[1, 2])) ```

which is quite common (at least in the tests) and a bit nicer than

python ds = xr.Dataset(coords=midx_coords.merge({"y": [1, 2]}).coords)

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8102/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 1 row from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.644ms · About: xarray-datasette