From 542032cbaf863ec87358265d368bfe9e541d4098 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Fri, 5 Nov 2021 09:54:11 +0530 Subject: [PATCH 01/19] import error resolved --- pandas/core/dtypes/common.py | 2 +- pandas/tests/base/test_misc.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 815a0a2040ddb..742a1e025ef8c 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -601,7 +601,7 @@ def is_dtype_equal(source, target) -> bool: # is_dtype_equal(CDT, "category") and CDT == "category" try: src = get_dtype(source) - if isinstance(src, ExtensionDtype): + if isinstance(src, ExtensionDtype) or isinstance(src, np.dtype): return src == target except (TypeError, AttributeError): return False diff --git a/pandas/tests/base/test_misc.py b/pandas/tests/base/test_misc.py index c0250e2b3e958..efb2a8bdfe7f6 100644 --- a/pandas/tests/base/test_misc.py +++ b/pandas/tests/base/test_misc.py @@ -11,6 +11,7 @@ from pandas.core.dtypes.common import ( is_categorical_dtype, is_object_dtype, + is_dtype_equal ) import pandas as pd @@ -150,6 +151,9 @@ def test_access_by_position(index): assert index[-1] == index[size - 1] msg = f"index {size} is out of bounds for axis 0 with size {size}" + + assert not is_dtype_equal(index.dtype, "string[pyarrow]") + with pytest.raises(IndexError, match=msg): index[size] msg = "single positional indexer is out-of-bounds" From 76ab6fa0d822e7ca4ad3cd0b5f4cf797ac354597 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Sat, 6 Nov 2021 00:20:03 +0530 Subject: [PATCH 02/19] pre-commit --- pandas/core/dtypes/common.py | 1 + pandas/tests/base/test_misc.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 742a1e025ef8c..4a45437a7491f 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -602,6 +602,7 @@ def is_dtype_equal(source, target) -> bool: try: src = get_dtype(source) if isinstance(src, ExtensionDtype) or isinstance(src, np.dtype): + return src == target except (TypeError, AttributeError): return False diff --git a/pandas/tests/base/test_misc.py b/pandas/tests/base/test_misc.py index efb2a8bdfe7f6..a3cfe6e813711 100644 --- a/pandas/tests/base/test_misc.py +++ b/pandas/tests/base/test_misc.py @@ -153,7 +153,6 @@ def test_access_by_position(index): msg = f"index {size} is out of bounds for axis 0 with size {size}" assert not is_dtype_equal(index.dtype, "string[pyarrow]") - with pytest.raises(IndexError, match=msg): index[size] msg = "single positional indexer is out-of-bounds" From c82d836b8f76b45ed82c7c082ace68da513b0781 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Sat, 6 Nov 2021 00:22:16 +0530 Subject: [PATCH 03/19] Update test_misc.py --- pandas/tests/base/test_misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/base/test_misc.py b/pandas/tests/base/test_misc.py index a3cfe6e813711..1216dee6acb50 100644 --- a/pandas/tests/base/test_misc.py +++ b/pandas/tests/base/test_misc.py @@ -10,8 +10,8 @@ from pandas.core.dtypes.common import ( is_categorical_dtype, + is_dtype_equal, is_object_dtype, - is_dtype_equal ) import pandas as pd From c35e162f14593c1586ec778b7a6a5d991e74d7e2 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Sun, 7 Nov 2021 11:10:17 +0530 Subject: [PATCH 04/19] Changes done --- doc/source/whatsnew/v1.3.5.rst | 2 +- pandas/core/dtypes/common.py | 2 ++ pandas/tests/dtypes/test_dtypes.py | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.3.5.rst b/doc/source/whatsnew/v1.3.5.rst index 589092c0dd7e3..cdc999c4bf230 100644 --- a/doc/source/whatsnew/v1.3.5.rst +++ b/doc/source/whatsnew/v1.3.5.rst @@ -24,7 +24,7 @@ Fixed regressions Bug fixes ~~~~~~~~~ -- +- Fixed bug in :bug:`is_dtype_equal` raises if pyarrow not installed (:issue:`44327`) - .. --------------------------------------------------------------------------- diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 4a45437a7491f..fb8809d423830 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -599,6 +599,8 @@ def is_dtype_equal(source, target) -> bool: if not isinstance(source, str): # GH#38516 ensure we get the same behavior from # is_dtype_equal(CDT, "category") and CDT == "category" + # GH-44276 ensures behaviour is consistent + # is_dtype_equal (dtype, "string[pyarrow]") try: src = get_dtype(source) if isinstance(src, ExtensionDtype) or isinstance(src, np.dtype): diff --git a/pandas/tests/dtypes/test_dtypes.py b/pandas/tests/dtypes/test_dtypes.py index 30447de874aaa..b3016c82b2eaf 100644 --- a/pandas/tests/dtypes/test_dtypes.py +++ b/pandas/tests/dtypes/test_dtypes.py @@ -115,6 +115,10 @@ def test_construction_from_string(self, dtype): with pytest.raises(TypeError, match=msg): CategoricalDtype.construct_from_string("foo") + def test_pyarrow_string_import_error(self, dtype): + # GH-44276 + assert not is_dtype_equal(dtype, "string[pyarrow]") + def test_constructor_invalid(self): msg = "Parameter 'categories' must be list-like" with pytest.raises(TypeError, match=msg): From cff657ad17d7f965c2333bc5c259f688f56801d3 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Sun, 7 Nov 2021 11:19:17 +0530 Subject: [PATCH 05/19] Duplicate test removed --- pandas/tests/base/test_misc.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pandas/tests/base/test_misc.py b/pandas/tests/base/test_misc.py index 1216dee6acb50..134c329f26159 100644 --- a/pandas/tests/base/test_misc.py +++ b/pandas/tests/base/test_misc.py @@ -10,7 +10,6 @@ from pandas.core.dtypes.common import ( is_categorical_dtype, - is_dtype_equal, is_object_dtype, ) @@ -152,7 +151,6 @@ def test_access_by_position(index): msg = f"index {size} is out of bounds for axis 0 with size {size}" - assert not is_dtype_equal(index.dtype, "string[pyarrow]") with pytest.raises(IndexError, match=msg): index[size] msg = "single positional indexer is out-of-bounds" From dce9db6e109d87b459f7edddd6d08c26512cc335 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Mon, 8 Nov 2021 09:08:57 +0530 Subject: [PATCH 06/19] Changes done --- pandas/core/dtypes/common.py | 2 +- pandas/tests/base/test_misc.py | 1 - pandas/tests/dtypes/test_dtypes.py | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index fb8809d423830..6b5c0d7ce66de 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -603,7 +603,7 @@ def is_dtype_equal(source, target) -> bool: # is_dtype_equal (dtype, "string[pyarrow]") try: src = get_dtype(source) - if isinstance(src, ExtensionDtype) or isinstance(src, np.dtype): + if isinstance(src, (ExtensionDtype, np.dtype)): return src == target except (TypeError, AttributeError): diff --git a/pandas/tests/base/test_misc.py b/pandas/tests/base/test_misc.py index 134c329f26159..c0250e2b3e958 100644 --- a/pandas/tests/base/test_misc.py +++ b/pandas/tests/base/test_misc.py @@ -150,7 +150,6 @@ def test_access_by_position(index): assert index[-1] == index[size - 1] msg = f"index {size} is out of bounds for axis 0 with size {size}" - with pytest.raises(IndexError, match=msg): index[size] msg = "single positional indexer is out-of-bounds" diff --git a/pandas/tests/dtypes/test_dtypes.py b/pandas/tests/dtypes/test_dtypes.py index b3016c82b2eaf..5056d768a7b33 100644 --- a/pandas/tests/dtypes/test_dtypes.py +++ b/pandas/tests/dtypes/test_dtypes.py @@ -118,6 +118,8 @@ def test_construction_from_string(self, dtype): def test_pyarrow_string_import_error(self, dtype): # GH-44276 assert not is_dtype_equal(dtype, "string[pyarrow]") + with pytest.raises(ImportError, match="pyarrow"): + yield def test_constructor_invalid(self): msg = "Parameter 'categories' must be list-like" From 5abfa2efe4a54775cc3d8ab5a8db8d90a8ca1454 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Mon, 8 Nov 2021 22:21:29 +0530 Subject: [PATCH 07/19] raises modified --- doc/source/whatsnew/v1.3.5.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.3.5.rst b/doc/source/whatsnew/v1.3.5.rst index cdc999c4bf230..4a0f536ac1682 100644 --- a/doc/source/whatsnew/v1.3.5.rst +++ b/doc/source/whatsnew/v1.3.5.rst @@ -24,7 +24,7 @@ Fixed regressions Bug fixes ~~~~~~~~~ -- Fixed bug in :bug:`is_dtype_equal` raises if pyarrow not installed (:issue:`44327`) +- Fixed bug in :bug:`is_dtype_equal` raising if pyarrow not installed (:issue:`44327`) - .. --------------------------------------------------------------------------- From fb0bd2ad16cab5c0351c049b1b6f40c578695211 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Tue, 23 Nov 2021 21:52:25 +0530 Subject: [PATCH 08/19] changes done --- doc/source/whatsnew/v1.3.5.rst | 2 +- doc/source/whatsnew/v1.4.0.rst | 2 +- pandas/tests/dtypes/test_dtypes.py | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/source/whatsnew/v1.3.5.rst b/doc/source/whatsnew/v1.3.5.rst index 4a0f536ac1682..589092c0dd7e3 100644 --- a/doc/source/whatsnew/v1.3.5.rst +++ b/doc/source/whatsnew/v1.3.5.rst @@ -24,7 +24,7 @@ Fixed regressions Bug fixes ~~~~~~~~~ -- Fixed bug in :bug:`is_dtype_equal` raising if pyarrow not installed (:issue:`44327`) +- - .. --------------------------------------------------------------------------- diff --git a/doc/source/whatsnew/v1.4.0.rst b/doc/source/whatsnew/v1.4.0.rst index 4d0dee01f05c1..7942b53b3ff33 100644 --- a/doc/source/whatsnew/v1.4.0.rst +++ b/doc/source/whatsnew/v1.4.0.rst @@ -509,7 +509,7 @@ Conversion Strings ^^^^^^^ -- +- Fixed bug in :bug:`is_dtype_equal` raising if pyarrow not installed (:issue:`44327`) - Interval diff --git a/pandas/tests/dtypes/test_dtypes.py b/pandas/tests/dtypes/test_dtypes.py index 5056d768a7b33..f99c49888eaff 100644 --- a/pandas/tests/dtypes/test_dtypes.py +++ b/pandas/tests/dtypes/test_dtypes.py @@ -118,8 +118,7 @@ def test_construction_from_string(self, dtype): def test_pyarrow_string_import_error(self, dtype): # GH-44276 assert not is_dtype_equal(dtype, "string[pyarrow]") - with pytest.raises(ImportError, match="pyarrow"): - yield + pytest.importorskip("pyarrow") def test_constructor_invalid(self): msg = "Parameter 'categories' must be list-like" From f7b88885b918bc6479772f79070fa11e55660df2 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Fri, 26 Nov 2021 00:06:59 +0530 Subject: [PATCH 09/19] decorator fix --- pandas/tests/dtypes/test_dtypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/dtypes/test_dtypes.py b/pandas/tests/dtypes/test_dtypes.py index f99c49888eaff..030a309e324f5 100644 --- a/pandas/tests/dtypes/test_dtypes.py +++ b/pandas/tests/dtypes/test_dtypes.py @@ -115,10 +115,10 @@ def test_construction_from_string(self, dtype): with pytest.raises(TypeError, match=msg): CategoricalDtype.construct_from_string("foo") + @pytest.importorskip("pyarrow") def test_pyarrow_string_import_error(self, dtype): # GH-44276 assert not is_dtype_equal(dtype, "string[pyarrow]") - pytest.importorskip("pyarrow") def test_constructor_invalid(self): msg = "Parameter 'categories' must be list-like" From 2de493606e034a41ada00f24644e883ac0b45374 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Fri, 26 Nov 2021 13:32:51 +0530 Subject: [PATCH 10/19] Changed tests --- pandas/tests/dtypes/test_common.py | 5 ++++- pandas/tests/dtypes/test_dtypes.py | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index 14f6557fbc31e..587310dcee2c0 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -127,6 +127,10 @@ def test_dtype_equal(name1, dtype1, name2, dtype2): if name1 != name2: assert not com.is_dtype_equal(dtype1, dtype2) +@pytest.mark.parametrize("name,dtype", list(dtypes.items()), ids=lambda x: str(x)) +def test_pyarrow_string_import_error(name, dtype): + # GH-44276 + assert not com.is_dtype_equal(dtype, "string[pyarrow]") @pytest.mark.parametrize( "dtype1,dtype2", @@ -146,7 +150,6 @@ def test_dtype_equal(name1, dtype1, name2, dtype2): def test_dtype_equal_strict(dtype1, dtype2): assert not com.is_dtype_equal(dtype1, dtype2) - def get_is_dtype_funcs(): """ Get all functions in pandas.core.dtypes.common that diff --git a/pandas/tests/dtypes/test_dtypes.py b/pandas/tests/dtypes/test_dtypes.py index 030a309e324f5..30447de874aaa 100644 --- a/pandas/tests/dtypes/test_dtypes.py +++ b/pandas/tests/dtypes/test_dtypes.py @@ -115,11 +115,6 @@ def test_construction_from_string(self, dtype): with pytest.raises(TypeError, match=msg): CategoricalDtype.construct_from_string("foo") - @pytest.importorskip("pyarrow") - def test_pyarrow_string_import_error(self, dtype): - # GH-44276 - assert not is_dtype_equal(dtype, "string[pyarrow]") - def test_constructor_invalid(self): msg = "Parameter 'categories' must be list-like" with pytest.raises(TypeError, match=msg): From 66327e75a71be44c01581f125d2885360a91bfd6 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Fri, 26 Nov 2021 13:34:57 +0530 Subject: [PATCH 11/19] precommit --- pandas/tests/dtypes/test_common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index 587310dcee2c0..4865815e99187 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -127,11 +127,13 @@ def test_dtype_equal(name1, dtype1, name2, dtype2): if name1 != name2: assert not com.is_dtype_equal(dtype1, dtype2) + @pytest.mark.parametrize("name,dtype", list(dtypes.items()), ids=lambda x: str(x)) def test_pyarrow_string_import_error(name, dtype): # GH-44276 assert not com.is_dtype_equal(dtype, "string[pyarrow]") + @pytest.mark.parametrize( "dtype1,dtype2", [ @@ -150,6 +152,7 @@ def test_pyarrow_string_import_error(name, dtype): def test_dtype_equal_strict(dtype1, dtype2): assert not com.is_dtype_equal(dtype1, dtype2) + def get_is_dtype_funcs(): """ Get all functions in pandas.core.dtypes.common that From 9566360389c1dbd01442936508dd0ef5085dabe3 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Fri, 26 Nov 2021 16:13:22 +0530 Subject: [PATCH 12/19] StringDtype added --- pandas/core/dtypes/common.py | 4 +++- pandas/tests/dtypes/test_common.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 6b5c0d7ce66de..8fb45f8900018 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -596,7 +596,9 @@ def is_dtype_equal(source, target) -> bool: False """ if isinstance(target, str): - if not isinstance(source, str): + if get_dtype(source) == "string": + return False + elif not isinstance(source, str): # GH#38516 ensure we get the same behavior from # is_dtype_equal(CDT, "category") and CDT == "category" # GH-44276 ensures behaviour is consistent diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index 4865815e99187..3578021588513 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -115,6 +115,7 @@ def test_period_dtype(self, dtype): "float": np.dtype(np.float64), "object": np.dtype(object), "category": com.pandas_dtype("category"), + "string": pd.StringDtype(), } From 0f3554177e540a6ab1915905ed2a826d35684fe4 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Wed, 8 Dec 2021 09:06:07 +0530 Subject: [PATCH 13/19] Try-Except Changed --- pandas/core/dtypes/common.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 8fb45f8900018..2c9a1d7b63c88 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -596,9 +596,7 @@ def is_dtype_equal(source, target) -> bool: False """ if isinstance(target, str): - if get_dtype(source) == "string": - return False - elif not isinstance(source, str): + if not isinstance(source, str): # GH#38516 ensure we get the same behavior from # is_dtype_equal(CDT, "category") and CDT == "category" # GH-44276 ensures behaviour is consistent @@ -607,7 +605,7 @@ def is_dtype_equal(source, target) -> bool: src = get_dtype(source) if isinstance(src, (ExtensionDtype, np.dtype)): - return src == target + return type(src) == type(target) except (TypeError, AttributeError): return False elif isinstance(source, str): From 7ea6b154bafaf949098c51d633e4f82782368192 Mon Sep 17 00:00:00 2001 From: shubham11941140 <63910248+shubham11941140@users.noreply.github.com> Date: Wed, 8 Dec 2021 13:44:21 +0530 Subject: [PATCH 14/19] Changes Done --- doc/source/whatsnew/v1.4.0.rst | 2 +- pandas/core/dtypes/common.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/whatsnew/v1.4.0.rst b/doc/source/whatsnew/v1.4.0.rst index 7942b53b3ff33..ebd5d98be15fc 100644 --- a/doc/source/whatsnew/v1.4.0.rst +++ b/doc/source/whatsnew/v1.4.0.rst @@ -509,7 +509,7 @@ Conversion Strings ^^^^^^^ -- Fixed bug in :bug:`is_dtype_equal` raising if pyarrow not installed (:issue:`44327`) +- Fixed bug in :bug:`string[pyarrow]` dtype incorrectly raising an Import Error when pyarrow is not installed (:issue:`44327`) - Interval diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 2c9a1d7b63c88..705e3a7881e6d 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -605,8 +605,8 @@ def is_dtype_equal(source, target) -> bool: src = get_dtype(source) if isinstance(src, (ExtensionDtype, np.dtype)): - return type(src) == type(target) - except (TypeError, AttributeError): + return src == target + except (TypeError, AttributeError, ImportError): return False elif isinstance(source, str): return is_dtype_equal(target, source) From b0a75fc9f5fececd38555e30b758b980d58b2c7e Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 14 Dec 2021 14:32:17 +0100 Subject: [PATCH 15/19] remove np.dtype from isinstance check --- pandas/core/dtypes/common.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 6fc99f08475fa..e5657e42838a7 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -609,11 +609,9 @@ def is_dtype_equal(source, target) -> bool: if not isinstance(source, str): # GH#38516 ensure we get the same behavior from # is_dtype_equal(CDT, "category") and CDT == "category" - # GH-44276 ensures behaviour is consistent - # is_dtype_equal (dtype, "string[pyarrow]") try: src = get_dtype(source) - if isinstance(src, (ExtensionDtype, np.dtype)): + if isinstance(src, ExtensionDtype): return src == target except (TypeError, AttributeError, ImportError): From 75a4b26f7661fc6319408df7f8c69eab144200eb Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 14 Dec 2021 14:33:09 +0100 Subject: [PATCH 16/19] remove np.dtype from isinstance check, catch ImportError instead --- pandas/core/dtypes/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index e5657e42838a7..83a32f1abbf9a 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -623,7 +623,7 @@ def is_dtype_equal(source, target) -> bool: source = get_dtype(source) target = get_dtype(target) return source == target - except (TypeError, AttributeError): + except (TypeError, AttributeError, ImportError): # invalid comparison # object == category will hit this From f5bedc6ac60ee589377d290f1eec5f86145e9d54 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 14 Dec 2021 14:34:51 +0100 Subject: [PATCH 17/19] update whatsnew --- doc/source/whatsnew/v1.4.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.4.0.rst b/doc/source/whatsnew/v1.4.0.rst index a8e30bafe8d5c..bfd17089936b8 100644 --- a/doc/source/whatsnew/v1.4.0.rst +++ b/doc/source/whatsnew/v1.4.0.rst @@ -655,7 +655,7 @@ Conversion Strings ^^^^^^^ -- Fixed bug in :bug:`string[pyarrow]` dtype incorrectly raising an Import Error when pyarrow is not installed (:issue:`44327`) +- Fixed bug in checking for :bug:`string[pyarrow]` dtype incorrectly raising an ImportError when pyarrow is not installed (:issue:`44327`) - Interval From 9c68f5cdb349a3f1f4a1715241dbb73a463f98f3 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 14 Dec 2021 15:56:51 +0100 Subject: [PATCH 18/19] fix rst syntax in whatsnew --- doc/source/whatsnew/v1.4.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.4.0.rst b/doc/source/whatsnew/v1.4.0.rst index bfd17089936b8..1765b22dda05f 100644 --- a/doc/source/whatsnew/v1.4.0.rst +++ b/doc/source/whatsnew/v1.4.0.rst @@ -655,7 +655,7 @@ Conversion Strings ^^^^^^^ -- Fixed bug in checking for :bug:`string[pyarrow]` dtype incorrectly raising an ImportError when pyarrow is not installed (:issue:`44327`) +- Fixed bug in checking for ``string[pyarrow]`` dtype incorrectly raising an ImportError when pyarrow is not installed (:issue:`44327`) - Interval From c550a004507315b7bcd50d982e421c045b674fd3 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 14 Dec 2021 17:09:43 +0100 Subject: [PATCH 19/19] clean-up --- pandas/core/dtypes/common.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 83a32f1abbf9a..75689b8dba8f5 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -612,7 +612,6 @@ def is_dtype_equal(source, target) -> bool: try: src = get_dtype(source) if isinstance(src, ExtensionDtype): - return src == target except (TypeError, AttributeError, ImportError): return False