Cannot view pandas dataframe with categorical column in spyder variable explorer

I am using spyder IDE (version 2.3.4) and pandas (version 0.16.2). I have a dataframe where one of the columns is of a categorical data type. I can view regular data frames in the variable explorer without issue, but as soon as I make the column a categorical variable, the variable explorer fails. Here's an example:

df = pd.DataFrame([['type1', 0, 1], ['type2', 2, 3]])

      

Open df now in variable explorer and it works

df[0] = df[0].astype('category')

      

Opening df now in variable explorer results in the following error in spyder internal console: "ValueError: Incorrect number of items passed 2, placement means 1"

I do not want to drop the column or change its type to be able to view the dataframe in the variable explorer.

Can anyone tell me how to fix this? Or at least is this a bug in spyder or pandas?

+3


source to share





All Articles