Skip to content

BUG: indexing with boolean array and categoricals #12861

@jreback

Description

@jreback

xref #12857

In [24]: df2 = df.apply(lambda x: x.astype('category',categories=(np.sort(pd.unique(df.values.ravel())))))

In [25]: df2
Out[25]: 
   A  B
0  a  b
1  a  c
2  b  d
3  c  a
4  d  a
5  a  e

after #12564, the boolean array is ok

In [28]: df2=='d'
Out[28]: 
       A      B
0  False  False
1  False  False
2  False   True
3  False  False
4   True  False
5  False  False

but indexing is broken

In [26]: df2[df2=='c']
ValueError: Wrong number of dimensions

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugCategoricalCategorical Data TypeIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions