diff --git a/doc/source/v0.15.0.txt b/doc/source/v0.15.0.txt index c6e784ac93e92..7842b80cec46f 100644 --- a/doc/source/v0.15.0.txt +++ b/doc/source/v0.15.0.txt @@ -217,7 +217,7 @@ Internal Refactoring In 0.15.0 ``Index`` has internally been refactored to no longer sub-class ``ndarray`` but instead subclass ``PandasObject``, similarly to the rest of the pandas objects. This change allows very easy sub-classing and creation of new index types. This should be -a transparent change with only very limited API implications (:issue:`5080`, :issue:`7439`, :issue:`7796`) +a transparent change with only very limited API implications (:issue:`5080`, :issue:`7439`, :issue:`7796`, :issue:`8024`) - you may need to unpickle pandas version < 0.15.0 pickles using ``pd.read_pickle`` rather than ``pickle.load``. See :ref:`pickle docs ` - when plotting with a ``PeriodIndex``. The ``matplotlib`` internal axes will now be arrays of ``Period`` rather than a ``PeriodIndex``. (this is similar to how a ``DatetimeIndex`` passes arrays of ``datetimes`` now) diff --git a/pandas/core/index.py b/pandas/core/index.py index a58a3331f9759..c8836dae4ad7c 100644 --- a/pandas/core/index.py +++ b/pandas/core/index.py @@ -1506,6 +1506,9 @@ def _possibly_promote(self, other): from pandas.tseries.index import DatetimeIndex if self.inferred_type == 'date' and isinstance(other, DatetimeIndex): return DatetimeIndex(self), other + elif self.inferred_type == 'boolean': + if self.dtype != 'object': + return self.astype('object'), other.astype('object') return self, other def groupby(self, to_groupby): diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py index 24282fdc280af..022a8b543ce32 100644 --- a/pandas/tests/test_series.py +++ b/pandas/tests/test_series.py @@ -4968,6 +4968,13 @@ def test_map(self): result = self.ts.map(lambda x: x * 2) self.assert_numpy_array_equal(result, self.ts * 2) + def test_map_compat(self): + # related GH 8024 + s = Series([True,True,False],index=[1,2,3]) + result = s.map({ True : 'foo', False : 'bar' }) + expected = Series(['foo','foo','bar'],index=[1,2,3]) + assert_series_equal(result,expected) + def test_map_int(self): left = Series({'a': 1., 'b': 2., 'c': 3., 'd': 4}) right = Series({1: 11, 2: 22, 3: 33})