(fix): ExtensionArray + DataArray roundtrip - #9520
Merged
dcherian merged 8 commits intoSep 21, 2024
Merged
Conversation
ExtensionArray + DataArray roundtrip
3 tasks
dcherian
reviewed
Sep 19, 2024
dcherian
reviewed
Sep 19, 2024
dcherian
reviewed
Sep 19, 2024
…om:ilan-gold/xarray into ig/fix_extension_array_dataarray_roundtrip
dcherian
approved these changes
Sep 19, 2024
hollymandel
pushed a commit
to hollymandel/xarray
that referenced
this pull request
Sep 23, 2024
* (fix): fix extension array + dataarray roundtrip * (fix): satisfy mypy * (refactor): move check out of `Variable.values` * (fix): ensure `mypy` is happy with `values` typing * (fix): setter with `mypy` * (fix): remove case of `values`
Member
|
It appears that this PR may have broken some upstream pandas tests, specifically testing round-trips with various index types: Here's a minimal test case: import pandas as pd
import numpy as np
cat = pd.Categorical(list("abcd"))
df = pd.DataFrame({"f": cat}, index=cat)
restored = df.to_xarray().to_dataframe()
print(restored.index) # Index(['a', 'b', 'c', 'd'], dtype='object', name='index')
print(df.index) # CategoricalIndex(['a', 'b', 'c', 'd'], categories=['a', 'b', 'c', 'd'], ordered=False, dtype='category')I'm not sure if this is a pandas or xarray issue, but it's one or the other! (My guess is that most of these tests in pandas should probably live in xarray instead, given that we implement all the conversion logic.) |
Contributor
Author
|
@shoyer This is probably an "us" issue. I will look into it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I drive-by added
nameto theSeriessince it wasn't there before.to_pandasonDataArraywith extension array data type #9519whats-new.rstapi.rst