CategoricalIndex + and - should not be set operations? · Issue #10039 · pandas-dev/pandas (original) (raw)

Related with the issue I just opened (#10038), I relooked at the set operation deprecation issues we had before (xref #8227, #9095, #9630).

To make a summary:

But now, for the CategoricalIndex added, it is a set operation again (but with a warning):

In [1]: idx = pd.Index(pd.Categorical(['a', 'b']))

In [2]: idx
Out[2]:
CategoricalIndex([u'a', u'b'],
                 categories=[u'a', u'b'],
                 ordered=False,
                 name=None)

In [3]: idx - idx
c:\users\vdbosscj\scipy\pandas-joris\pandas\core\index.py:1191: FutureWarning: u
sing '-' to provide set differences with Indexes is deprecated, use .difference(
)
  "use .difference()", FutureWarning)
Out[3]: Index([], dtype='object')

As this is a new index, we should at once use the correct behaviour?
(Which is raising a TypeError I think?)