Skip to content

BUG: not converting series with CategoricalIndex #700

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

Closed
jreback opened this issue Jan 3, 2016 · 2 comments
Closed

BUG: not converting series with CategoricalIndex #700

jreback opened this issue Jan 3, 2016 · 2 comments
Labels
Milestone

Comments

@jreback
Copy link

jreback commented Jan 3, 2016

xray 0.6.1

In [1]: s = Series(range(5),index=pd.CategoricalIndex(list('aabbc'),name='foo'))

In [4]: xray.DataArray.from_series(s)
ValueError: object __array__ method not producing an array
@shoyer
Copy link
Member

shoyer commented Jan 4, 2016

Yep, we were relying on .values to return a NumPy array. This should be an easy fix.

@shoyer shoyer added the bug label Jan 8, 2016
@shoyer shoyer added this to the 0.7.0 milestone Jan 8, 2016
@jhamman jhamman modified the milestones: before 1.0, 0.7.0 Feb 11, 2016
@shoyer
Copy link
Member

shoyer commented Feb 1, 2017

This works now (tested with xarray v0.9):

In [7]: s.to_xarray().indexes['foo']
Out[7]: CategoricalIndex(['a', 'a', 'b', 'b', 'c'], categories=['a', 'b', 'c'], ordered=False, name='foo', dtype='category')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants