-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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): ExtensionArray
+ DataArray
roundtrip
#9520
(fix): ExtensionArray
+ DataArray
roundtrip
#9520
Conversation
ExtensionArray
+ DataArray
roundtrip
…om:ilan-gold/xarray into ig/fix_extension_array_dataarray_roundtrip
* (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`
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.) |
@shoyer This is probably an "us" issue. I will look into it. |
I drive-by added
name
to theSeries
since it wasn't there before.to_pandas
onDataArray
with extension array data type #9519whats-new.rst
api.rst