No deprecation warning raised for index - list operation · Issue #10038 · pandas-dev/pandas (original) (raw)

Ilustration:

idx = pd.Index(['a', 'b', 'c', 'd'])
idx - ['a', 'd']
idx - pd.Index(['a', 'd'])

gives:

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

In [2]: idx - ['a', 'd']
Out[2]: Index([u'b', u'c'], dtype='object')

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

So a list is treated a an index-like (as it performs a set operation), but does not raise a warning as it should (the same for arrays, series).

We have an occurrence in the docs of this one.