Skip to content

BUG: iloc misbehavior with pd.Series: sometimes returns pd.Categorical instead #14580

Closed
@navin-k80

Description

@navin-k80

A small, complete example of the issue

# Your code here
>>> type(pd.Series([1,2,3]).astype('category').iloc[0:1])
<class 'pandas.core.series.Series'>

>>> type(pd.Series([1,2,3]).astype('category').iloc[np.array([0, 1])])
<class 'pandas.core.categorical.Categorical'>

Expected Output

Both should return a pandas Series object

Output of pd.show_versions()

pandas version = 0.18

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions