Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix multiindex unstack future warning #427

Merged
merged 3 commits into from
Jul 9, 2024
Merged

fix multiindex unstack future warning #427

merged 3 commits into from
Jul 9, 2024

Conversation

juliettelavoie
Copy link
Contributor

@juliettelavoie juliettelavoie commented Jul 8, 2024

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • (If applicable) Documentation has been added / updated (for bug fixes / features).
  • (If applicable) Tests have been added.
  • This PR does not seem to break the templates.
  • CHANGELOG.rst has been updated (with summary of main changes).
    • Link to issue (:issue:number) and pull request (:pull:number) has been added.

What kind of change does this PR introduce?

  • explicitely assign the lat and lon coords of the lov multiindex.
  • in response to:
/tmp/ipykernel_94931/2504572846.py:29: FutureWarning: the `pandas.MultiIndex` object(s) passed as 'loc' coordinate(s) or data variable(s) will no longer be implicitly promoted and wrapped into multiple indexed coordinates in the future (i.e., one coordinate for each multi-index level + one dimension coordinate). If you want to keep this behavior, you need to first wrap it explicitly using `mindex_coords = xarray.Coordinates.from_pandas_multiindex(mindex_obj, 'dim')` and pass it as coordinates, e.g., `xarray.Dataset(coords=mindex_coords)`, `dataset.assign_coords(mindex_coords)` or `dataarray.assign_coords(mindex_coords)`.

Does this PR introduce a breaking change?

no

Other information:

@juliettelavoie juliettelavoie requested a review from RondeauG July 8, 2024 19:01
@juliettelavoie juliettelavoie merged commit bba8c97 into main Jul 9, 2024
16 checks passed
@juliettelavoie juliettelavoie deleted the fix-future branch July 9, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants