v0.15.1 breaks index set operations · Issue #9095 · pandas-dev/pandas (original) (raw)

In 0.15.0, the - index set operation raises a warning as is explained in the whatsnew docs: http://pandas.pydata.org/pandas-docs/stable/whatsnew.html#deprecations

In [1]: pd.__version__
Out[1]: '0.15.0'

In [2]: idx = pd.Index([1,2])

In [3]: idx
Out[3]: Int64Index([1, 2], dtype='int64')

In [4]: idx - idx
C:\Anaconda\envs\pandas0150\lib\site-packages\pandas\core\index.py:1162: FutureW
arning: using '-' to provide set differences with Indexes is deprecated, use .di
fference()
  "use .difference()",FutureWarning)
Out[4]: Index([], dtype='object')

In [6]: idx = pd.date_range('2012-01-01', periods=2)

In [7]: idx - idx
Out[7]: Index([], dtype='object')

In [8]: idx = pd.Index([1.1,2])

In [10]: idx
Out[10]: Float64Index([1.1, 2.0], dtype='float64')

In [11]: idx - idx
Out[11]: Index([], dtype='object')

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

In [13]: idx - idx
Out[13]: Index([], dtype='object')

But in 0.15.1:

In [1]: pd.__version__
Out[1]: '0.15.1'

In [2]: idx = pd.Index([1,2])

In [3]: idx
Out[3]: Int64Index([1, 2], dtype='int64')

In [4]: idx - idx
Out[4]: Int64Index([0, 0], dtype='int64')

In [5]: idx = pd.date_range('2012-01-01', periods=2)

In [6]: idx - idx
Out[6]: Index([], dtype='object')

In [7]: idx = pd.Index([1.1,2])

In [8]: idx - idx
Out[8]: Float64Index([0.0, 0.0], dtype='float64')

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

In [10]: idx - idx
pandas\core\index.py:1172: FutureWarning: using '-' to provide set differences w
ith Indexes is deprecated, use .difference()
  "use .difference()",FutureWarning)
Out[10]: Index([], dtype='object')

So

And the same on master (and 0.15.2)