BUG: iloc misbehavior with pd.Series: sometimes returns pd.Categorical instead (original) (raw)

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()

Detailspandas version = 0.18