From af2ab195f44a96e4ab06d249da02b032d1d43849 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Tue, 31 Jul 2018 20:00:09 +0100 Subject: [PATCH 01/13] BUG: Fix for TypeError: unorderable types" for multi index (#15457) --- pandas/core/arrays/categorical.py | 5 ++++- pandas/tests/indexes/multi/test_constructor.py | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 003ba7608dea4..4bada811ccaf7 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -2538,7 +2538,10 @@ def _factorize_from_iterable(values): ordered=values.ordered) codes = values.codes else: - cat = Categorical(values, ordered=True) + # The value of ordered is irrelevant since we don't use cat as such, + # but only the resulting categories, the order of which is independent + # from ordered. Set ordered to False as default due to issue #15457 + cat = Categorical(values, ordered=False) categories = cat.categories codes = cat.codes return codes, categories diff --git a/pandas/tests/indexes/multi/test_constructor.py b/pandas/tests/indexes/multi/test_constructor.py index 4b8d0553886b2..37925c389473b 100644 --- a/pandas/tests/indexes/multi/test_constructor.py +++ b/pandas/tests/indexes/multi/test_constructor.py @@ -313,6 +313,13 @@ def test_from_product_empty_zero_levels(): MultiIndex.from_product([]) +def test_set_index_tuple(): + # test for fix of issue #15457, where the following raised a TypeError + result = pd.MultiIndex.from_arrays([[2, 4], [1, (1, 2)]]) + expected = pd.MultiIndex.from_tuples([(2, 4), (1, (1, 2))]) + assert result == expected + + def test_from_product_empty_one_level(): result = MultiIndex.from_product([[]], names=['A']) expected = pd.Index([], name='A') From 9bf7262db0339ed36efdba70f8600c489b9b7e13 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Sat, 4 Aug 2018 13:49:56 +0100 Subject: [PATCH 02/13] revert to test with dictionary --- pandas/tests/frame/test_alter_axes.py | 5 +++++ pandas/tests/indexes/multi/test_constructor.py | 8 +------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pandas/tests/frame/test_alter_axes.py b/pandas/tests/frame/test_alter_axes.py index 4f95eb3fe7b47..c95853c7c5ca6 100644 --- a/pandas/tests/frame/test_alter_axes.py +++ b/pandas/tests/frame/test_alter_axes.py @@ -392,6 +392,11 @@ def test_dti_set_index_reindex(self): assert new_index.freq == index.freq + def test_set_index_tuple(self): + # test for fix of issue #15457, where the following raised a TypeError + df = DataFrame([[2, 1, 2], [4, (1, 2), 3]]).set_index([0, 1]) + assert df.to_dict() == {2: {(2, 1): 2, (4, (1, 2)): 3}} + # Renaming def test_rename(self): diff --git a/pandas/tests/indexes/multi/test_constructor.py b/pandas/tests/indexes/multi/test_constructor.py index 37925c389473b..0f69ce62bae86 100644 --- a/pandas/tests/indexes/multi/test_constructor.py +++ b/pandas/tests/indexes/multi/test_constructor.py @@ -313,13 +313,6 @@ def test_from_product_empty_zero_levels(): MultiIndex.from_product([]) -def test_set_index_tuple(): - # test for fix of issue #15457, where the following raised a TypeError - result = pd.MultiIndex.from_arrays([[2, 4], [1, (1, 2)]]) - expected = pd.MultiIndex.from_tuples([(2, 4), (1, (1, 2))]) - assert result == expected - - def test_from_product_empty_one_level(): result = MultiIndex.from_product([[]], names=['A']) expected = pd.Index([], name='A') @@ -470,3 +463,4 @@ def test_tuples_with_name_string(): pd.Index(li, name='abc') with pytest.raises(ValueError): pd.Index(li, name='a') + From bcea58b23d4e500fd71eb7ac7b4145a447a0c0d5 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Wed, 8 Aug 2018 21:50:27 +0100 Subject: [PATCH 03/13] pylint fixes, new test --- pandas/tests/frame/test_alter_axes.py | 5 +++-- pandas/tests/indexes/multi/test_constructor.py | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/tests/frame/test_alter_axes.py b/pandas/tests/frame/test_alter_axes.py index c95853c7c5ca6..7c86bb94b5d7c 100644 --- a/pandas/tests/frame/test_alter_axes.py +++ b/pandas/tests/frame/test_alter_axes.py @@ -394,8 +394,9 @@ def test_dti_set_index_reindex(self): def test_set_index_tuple(self): # test for fix of issue #15457, where the following raised a TypeError - df = DataFrame([[2, 1, 2], [4, (1, 2), 3]]).set_index([0, 1]) - assert df.to_dict() == {2: {(2, 1): 2, (4, (1, 2)): 3}} + expected = pd.DataFrame([[2, 1], [4, (1, 2)]]).set_index([0, 1]).index + result = pd.MultiIndex.from_tuples([(2, 1), (4, (1, 2))], names=(0, 1)) + tm.assert_index_equal(expected, result) # Renaming diff --git a/pandas/tests/indexes/multi/test_constructor.py b/pandas/tests/indexes/multi/test_constructor.py index 0f69ce62bae86..4b8d0553886b2 100644 --- a/pandas/tests/indexes/multi/test_constructor.py +++ b/pandas/tests/indexes/multi/test_constructor.py @@ -463,4 +463,3 @@ def test_tuples_with_name_string(): pd.Index(li, name='abc') with pytest.raises(ValueError): pd.Index(li, name='a') - From 42f093dc5f560feed2806a8919a60df043fe16d3 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Wed, 8 Aug 2018 23:11:51 +0100 Subject: [PATCH 04/13] text correction --- pandas/core/arrays/categorical.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 4bada811ccaf7..754aa689533f2 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -2540,7 +2540,7 @@ def _factorize_from_iterable(values): else: # The value of ordered is irrelevant since we don't use cat as such, # but only the resulting categories, the order of which is independent - # from ordered. Set ordered to False as default due to issue #15457 + # from ordered. Set ordered to False as default. See GH #15457" cat = Categorical(values, ordered=False) categories = cat.categories codes = cat.codes From bba1e9cc7a2ced9bee8f0a93517dcd2f13394523 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Fri, 10 Aug 2018 09:49:09 +0100 Subject: [PATCH 05/13] changes as per comments --- doc/source/whatsnew/v0.24.0.txt | 2 +- pandas/core/arrays/categorical.py | 2 +- pandas/tests/frame/test_alter_axes.py | 8 +------ .../tests/indexes/multi/test_constructor.py | 23 ++++++++++++------- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index f26d3d76592d0..b6b5289db8619 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -626,7 +626,7 @@ MultiIndex - Removed compatibility for :class:`MultiIndex` pickles prior to version 0.8.0; compatibility with :class:`MultiIndex` pickles from version 0.13 forward is maintained (:issue:`21654`) - :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a :class:``MultiIndex``ed object) will now raise a ``KeyError``, rather than returning an empty ``slice``, if asked a label which is present in the ``levels`` but is unused (:issue:`22221`) -- +- Fix issue when creating :class:`MultiIndex` from mixed type arrays including tuples. In some cases df.set_index(['A','B']) raised a ``TypeError unorderable types`` when trying to set multiple columns as indices. (:issue:'15457') I/O ^^^ diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 754aa689533f2..c4144d2e8b086 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -2540,7 +2540,7 @@ def _factorize_from_iterable(values): else: # The value of ordered is irrelevant since we don't use cat as such, # but only the resulting categories, the order of which is independent - # from ordered. Set ordered to False as default. See GH #15457" + # from ordered. Set ordered to False as default. See GH #15457 cat = Categorical(values, ordered=False) categories = cat.categories codes = cat.codes diff --git a/pandas/tests/frame/test_alter_axes.py b/pandas/tests/frame/test_alter_axes.py index 7c86bb94b5d7c..cca59a9bcaae0 100644 --- a/pandas/tests/frame/test_alter_axes.py +++ b/pandas/tests/frame/test_alter_axes.py @@ -261,7 +261,7 @@ def test_set_index_cast_datetimeindex(self): comp = comp.tz_localize(None) tm.assert_numpy_array_equal(result.values, comp.values) - # list of datetimes with a tz + # list of datetimes with a tzg df['D'] = i.to_pydatetime() result = df['D'] assert_series_equal(result, expected, check_names=False) @@ -392,12 +392,6 @@ def test_dti_set_index_reindex(self): assert new_index.freq == index.freq - def test_set_index_tuple(self): - # test for fix of issue #15457, where the following raised a TypeError - expected = pd.DataFrame([[2, 1], [4, (1, 2)]]).set_index([0, 1]).index - result = pd.MultiIndex.from_tuples([(2, 1), (4, (1, 2))], names=(0, 1)) - tm.assert_index_equal(expected, result) - # Renaming def test_rename(self): diff --git a/pandas/tests/indexes/multi/test_constructor.py b/pandas/tests/indexes/multi/test_constructor.py index 4b8d0553886b2..e5bd8236babf4 100644 --- a/pandas/tests/indexes/multi/test_constructor.py +++ b/pandas/tests/indexes/multi/test_constructor.py @@ -3,11 +3,12 @@ import re import numpy as np +import pytest +from pandas._libs.tslib import Timestamp + import pandas as pd import pandas.util.testing as tm -import pytest from pandas import Index, MultiIndex, date_range -from pandas._libs.tslib import Timestamp from pandas.compat import lrange, range from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike @@ -23,7 +24,7 @@ def test_constructor_single_level(): def test_constructor_no_levels(): tm.assert_raises_regex(ValueError, "non-zero number " - "of levels/labels", + "of levels/labels", MultiIndex, levels=[], labels=[]) both_re = re.compile('Must pass both levels and labels') with tm.assert_raises_regex(TypeError, both_re): @@ -56,7 +57,7 @@ def test_constructor_mismatched_label_levels(idx): labels = [np.array([1]), np.array([2]), np.array([3])] levels = ["a"] tm.assert_raises_regex(ValueError, "Length of levels and labels " - "must be the same", MultiIndex, + "must be the same", MultiIndex, levels=levels, labels=labels) length_error = re.compile('>= length of level') label_error = re.compile(r'Unequal label lengths: \[4, 2\]') @@ -259,13 +260,13 @@ def test_from_arrays_invalid_input(invalid_array): def test_from_arrays_different_lengths(idx1, idx2): # see gh-13599 tm.assert_raises_regex(ValueError, '^all arrays must ' - 'be same length$', + 'be same length$', MultiIndex.from_arrays, [idx1, idx2]) def test_from_tuples(): tm.assert_raises_regex(TypeError, 'Cannot infer number of levels ' - 'from empty list', + 'from empty list', MultiIndex.from_tuples, []) expected = MultiIndex(levels=[[1, 3], [2, 4]], @@ -390,7 +391,6 @@ def test_from_product_index_series_categorical(ordered, f): def test_from_product(): - first = ['foo', 'bar', 'buz'] second = ['a', 'b', 'c'] names = ['first', 'second'] @@ -425,7 +425,6 @@ def test_from_product_iterator(): def test_create_index_existing_name(idx): - # GH11193, when an existing index is passed, and a new name is not # specified, the new index should inherit the previous object name index = idx @@ -463,3 +462,11 @@ def test_tuples_with_name_string(): pd.Index(li, name='abc') with pytest.raises(ValueError): pd.Index(li, name='a') + + +def test_from_tuples_with_tuple_label(): + # test for fix of issue #15457, where the following raised a TypeError + expected = pd.DataFrame([[2, 1, 2], [4, (1, 2), 3]], columns=['a', 'b', 'c']).set_index(['a', 'b']) + idx = pd.MultiIndex.from_tuples([(2, 1), (4, (1, 2))], names=('a', 'b')) + result = pd.DataFrame([2, 3], columns=['c'], index=idx) + tm.assert_frame_equal(expected, result) From 1b3959e665395f4aa4cf559f747ac8f5b6f59976 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Fri, 10 Aug 2018 10:09:18 +0100 Subject: [PATCH 06/13] revert changes --- pandas/tests/frame/test_alter_axes.py | 2 +- pandas/tests/indexes/multi/test_constructor.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pandas/tests/frame/test_alter_axes.py b/pandas/tests/frame/test_alter_axes.py index cca59a9bcaae0..4f95eb3fe7b47 100644 --- a/pandas/tests/frame/test_alter_axes.py +++ b/pandas/tests/frame/test_alter_axes.py @@ -261,7 +261,7 @@ def test_set_index_cast_datetimeindex(self): comp = comp.tz_localize(None) tm.assert_numpy_array_equal(result.values, comp.values) - # list of datetimes with a tzg + # list of datetimes with a tz df['D'] = i.to_pydatetime() result = df['D'] assert_series_equal(result, expected, check_names=False) diff --git a/pandas/tests/indexes/multi/test_constructor.py b/pandas/tests/indexes/multi/test_constructor.py index e5bd8236babf4..e401eaca6eb0b 100644 --- a/pandas/tests/indexes/multi/test_constructor.py +++ b/pandas/tests/indexes/multi/test_constructor.py @@ -3,12 +3,11 @@ import re import numpy as np -import pytest -from pandas._libs.tslib import Timestamp - import pandas as pd import pandas.util.testing as tm +import pytest from pandas import Index, MultiIndex, date_range +from pandas._libs.tslib import Timestamp from pandas.compat import lrange, range from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike @@ -24,7 +23,7 @@ def test_constructor_single_level(): def test_constructor_no_levels(): tm.assert_raises_regex(ValueError, "non-zero number " - "of levels/labels", + "of levels/labels", MultiIndex, levels=[], labels=[]) both_re = re.compile('Must pass both levels and labels') with tm.assert_raises_regex(TypeError, both_re): @@ -57,7 +56,7 @@ def test_constructor_mismatched_label_levels(idx): labels = [np.array([1]), np.array([2]), np.array([3])] levels = ["a"] tm.assert_raises_regex(ValueError, "Length of levels and labels " - "must be the same", MultiIndex, + "must be the same", MultiIndex, levels=levels, labels=labels) length_error = re.compile('>= length of level') label_error = re.compile(r'Unequal label lengths: \[4, 2\]') @@ -260,13 +259,13 @@ def test_from_arrays_invalid_input(invalid_array): def test_from_arrays_different_lengths(idx1, idx2): # see gh-13599 tm.assert_raises_regex(ValueError, '^all arrays must ' - 'be same length$', + 'be same length$', MultiIndex.from_arrays, [idx1, idx2]) def test_from_tuples(): tm.assert_raises_regex(TypeError, 'Cannot infer number of levels ' - 'from empty list', + 'from empty list', MultiIndex.from_tuples, []) expected = MultiIndex(levels=[[1, 3], [2, 4]], @@ -391,6 +390,7 @@ def test_from_product_index_series_categorical(ordered, f): def test_from_product(): + first = ['foo', 'bar', 'buz'] second = ['a', 'b', 'c'] names = ['first', 'second'] @@ -425,6 +425,7 @@ def test_from_product_iterator(): def test_create_index_existing_name(idx): + # GH11193, when an existing index is passed, and a new name is not # specified, the new index should inherit the previous object name index = idx @@ -463,9 +464,8 @@ def test_tuples_with_name_string(): with pytest.raises(ValueError): pd.Index(li, name='a') - def test_from_tuples_with_tuple_label(): - # test for fix of issue #15457, where the following raised a TypeError + # GH 15457 expected = pd.DataFrame([[2, 1, 2], [4, (1, 2), 3]], columns=['a', 'b', 'c']).set_index(['a', 'b']) idx = pd.MultiIndex.from_tuples([(2, 1), (4, (1, 2))], names=('a', 'b')) result = pd.DataFrame([2, 3], columns=['c'], index=idx) From 10ed01a2f803207eb086c9ada86719d3fc8e7e3a Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Fri, 10 Aug 2018 10:40:55 +0100 Subject: [PATCH 07/13] better description --- doc/source/whatsnew/v0.24.0.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index b6b5289db8619..6f3909c7c1241 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -626,7 +626,7 @@ MultiIndex - Removed compatibility for :class:`MultiIndex` pickles prior to version 0.8.0; compatibility with :class:`MultiIndex` pickles from version 0.13 forward is maintained (:issue:`21654`) - :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a :class:``MultiIndex``ed object) will now raise a ``KeyError``, rather than returning an empty ``slice``, if asked a label which is present in the ``levels`` but is unused (:issue:`22221`) -- Fix issue when creating :class:`MultiIndex` from mixed type arrays including tuples. In some cases df.set_index(['A','B']) raised a ``TypeError unorderable types`` when trying to set multiple columns as indices. (:issue:'15457') +- Fix `TypeError` in Python 3 when creating `MultiIndex` in which some columns are of object type, e.g. when labels are tuples (:issue:'15457') I/O ^^^ From 801803a3c33ebba1952f693e2daae15a0bfc8d4d Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Fri, 10 Aug 2018 12:30:11 +0100 Subject: [PATCH 08/13] more fixes --- doc/source/whatsnew/v0.24.0.txt | 2 +- pandas/tests/indexes/multi/test_constructor.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 6f3909c7c1241..cd9c42bbee8df 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -626,7 +626,7 @@ MultiIndex - Removed compatibility for :class:`MultiIndex` pickles prior to version 0.8.0; compatibility with :class:`MultiIndex` pickles from version 0.13 forward is maintained (:issue:`21654`) - :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a :class:``MultiIndex``ed object) will now raise a ``KeyError``, rather than returning an empty ``slice``, if asked a label which is present in the ``levels`` but is unused (:issue:`22221`) -- Fix `TypeError` in Python 3 when creating `MultiIndex` in which some columns are of object type, e.g. when labels are tuples (:issue:'15457') +- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some columns are of object type, e.g. when labels are tuples (:issue:`15457`) I/O ^^^ diff --git a/pandas/tests/indexes/multi/test_constructor.py b/pandas/tests/indexes/multi/test_constructor.py index e401eaca6eb0b..ab2e4c1d863a7 100644 --- a/pandas/tests/indexes/multi/test_constructor.py +++ b/pandas/tests/indexes/multi/test_constructor.py @@ -464,9 +464,11 @@ def test_tuples_with_name_string(): with pytest.raises(ValueError): pd.Index(li, name='a') + def test_from_tuples_with_tuple_label(): # GH 15457 - expected = pd.DataFrame([[2, 1, 2], [4, (1, 2), 3]], columns=['a', 'b', 'c']).set_index(['a', 'b']) + expected = pd.DataFrame([[2, 1, 2], [4, (1, 2), 3]], + columns=['a', 'b', 'c']).set_index(['a', 'b']) idx = pd.MultiIndex.from_tuples([(2, 1), (4, (1, 2))], names=('a', 'b')) result = pd.DataFrame([2, 3], columns=['c'], index=idx) tm.assert_frame_equal(expected, result) From 8daf9e6d435c2d51dceb4796e3641e7de9e7adb2 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Fri, 10 Aug 2018 14:39:29 +0200 Subject: [PATCH 09/13] change in doc as per comments --- doc/source/whatsnew/v0.24.0.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index cd9c42bbee8df..1e987c183e2f5 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -626,7 +626,7 @@ MultiIndex - Removed compatibility for :class:`MultiIndex` pickles prior to version 0.8.0; compatibility with :class:`MultiIndex` pickles from version 0.13 forward is maintained (:issue:`21654`) - :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a :class:``MultiIndex``ed object) will now raise a ``KeyError``, rather than returning an empty ``slice``, if asked a label which is present in the ``levels`` but is unused (:issue:`22221`) -- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some columns are of object type, e.g. when labels are tuples (:issue:`15457`) +- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some levels have mixed types, e.g. when labels are tuples (:issue:`15457`) I/O ^^^ From 4cd3c0cf193dab640c7f7590457d0861ab126b53 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Fri, 10 Aug 2018 17:05:42 +0200 Subject: [PATCH 10/13] text change --- doc/source/whatsnew/v0.24.0.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 1e987c183e2f5..689c84ff7adbe 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -626,7 +626,7 @@ MultiIndex - Removed compatibility for :class:`MultiIndex` pickles prior to version 0.8.0; compatibility with :class:`MultiIndex` pickles from version 0.13 forward is maintained (:issue:`21654`) - :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a :class:``MultiIndex``ed object) will now raise a ``KeyError``, rather than returning an empty ``slice``, if asked a label which is present in the ``levels`` but is unused (:issue:`22221`) -- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some levels have mixed types, e.g. when labels are tuples (:issue:`15457`) +- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some levels have mixed types, e.g. when some labels are tuples (:issue:`15457`) I/O ^^^ From c45705ccb385f05ecc728bd9a184443c34618cbd Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Fri, 10 Aug 2018 17:10:41 +0200 Subject: [PATCH 11/13] additional text changes --- doc/source/whatsnew/v0.24.0.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 689c84ff7adbe..d208f1e6d6e72 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -626,7 +626,7 @@ MultiIndex - Removed compatibility for :class:`MultiIndex` pickles prior to version 0.8.0; compatibility with :class:`MultiIndex` pickles from version 0.13 forward is maintained (:issue:`21654`) - :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a :class:``MultiIndex``ed object) will now raise a ``KeyError``, rather than returning an empty ``slice``, if asked a label which is present in the ``levels`` but is unused (:issue:`22221`) -- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some levels have mixed types, e.g. when some labels are tuples (:issue:`15457`) +- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some levels have mixed types. If (for instance) all labels are tuples of ints, there is no problem (:issue:`15457`) I/O ^^^ From 927f24f54ec580a73c291b6d44aebd4ba78f7534 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Sat, 11 Aug 2018 10:55:27 +0100 Subject: [PATCH 12/13] Revert "additional text changes" This reverts commit b645286 --- doc/source/whatsnew/v0.24.0.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index d208f1e6d6e72..689c84ff7adbe 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -626,7 +626,7 @@ MultiIndex - Removed compatibility for :class:`MultiIndex` pickles prior to version 0.8.0; compatibility with :class:`MultiIndex` pickles from version 0.13 forward is maintained (:issue:`21654`) - :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a :class:``MultiIndex``ed object) will now raise a ``KeyError``, rather than returning an empty ``slice``, if asked a label which is present in the ``levels`` but is unused (:issue:`22221`) -- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some levels have mixed types. If (for instance) all labels are tuples of ints, there is no problem (:issue:`15457`) +- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some levels have mixed types, e.g. when some labels are tuples (:issue:`15457`) I/O ^^^ From 213c4ea42f2aaaa4f8c8ed359297b2b864c0f7ca Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Sat, 11 Aug 2018 14:07:02 +0200 Subject: [PATCH 13/13] text fix --- doc/source/whatsnew/v0.24.0.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 689c84ff7adbe..2ddfba6d01a1b 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -626,7 +626,7 @@ MultiIndex - Removed compatibility for :class:`MultiIndex` pickles prior to version 0.8.0; compatibility with :class:`MultiIndex` pickles from version 0.13 forward is maintained (:issue:`21654`) - :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a :class:``MultiIndex``ed object) will now raise a ``KeyError``, rather than returning an empty ``slice``, if asked a label which is present in the ``levels`` but is unused (:issue:`22221`) -- Fix `TypeError` in Python 3 when creating :class: `MultiIndex` in which some levels have mixed types, e.g. when some labels are tuples (:issue:`15457`) +- Fix ``TypeError`` in Python 3 when creating :class:`MultiIndex` in which some levels have mixed types, e.g. when some labels are tuples (:issue:`15457`) I/O ^^^