From beea812eeab4db0eb52c1fa3e4493115c310f087 Mon Sep 17 00:00:00 2001 From: BarkotBeyene Date: Thu, 11 Aug 2022 15:39:52 -0500 Subject: [PATCH 1/5] TST: GH39984 Addition to tests --- .../tests/indexes/multi/test_constructors.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pandas/tests/indexes/multi/test_constructors.py b/pandas/tests/indexes/multi/test_constructors.py index 7fad59fc6654c..0cb7e680483d6 100644 --- a/pandas/tests/indexes/multi/test_constructors.py +++ b/pandas/tests/indexes/multi/test_constructors.py @@ -6,6 +6,9 @@ import numpy as np import pytest +import pyarrow as pa + +from pandas.compat import pa_version_under1p01 from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike @@ -647,6 +650,26 @@ def test_from_frame(): result = MultiIndex.from_frame(df) tm.assert_index_equal(expected, result) + +@pytest.mark.skipif(pa_version_under1p01) +def test_from_frame_missing_values_multiIndex(): + # GH 39984 + df = pd.DataFrame( + { + "a": Series([1, 2, None], dtype="Int64"), + "b": pd.Float64Dtype().__from_arrow__(pa.array([0.2, np.nan, None])), + } + ) + multi_indexed = MultiIndex.from_frame(df) + expected = MultiIndex.from_arrays( + [ + Series([1, 2, None]).astype("Int64"), + pd.Float64Dtype().__from_arrow__(pa.array([0.2, np.nan, None])), + ], + names=["a", "b"], + ) + tm.assert_index_equal(multi_indexed, expected) + @pytest.mark.parametrize( "non_frame", From c2dd25a833945f85d0bb9939f190e1730b58e4e3 Mon Sep 17 00:00:00 2001 From: BarkotBeyene Date: Fri, 12 Aug 2022 03:23:54 -0500 Subject: [PATCH 2/5] TST: GH39984 Addition to tests --- pandas/tests/indexes/multi/test_constructors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/indexes/multi/test_constructors.py b/pandas/tests/indexes/multi/test_constructors.py index 0cb7e680483d6..d99bcd97d2333 100644 --- a/pandas/tests/indexes/multi/test_constructors.py +++ b/pandas/tests/indexes/multi/test_constructors.py @@ -5,8 +5,8 @@ import itertools import numpy as np -import pytest import pyarrow as pa +import pytest from pandas.compat import pa_version_under1p01 From e6af9622daecc543e7d2224f1765518a1c5735d7 Mon Sep 17 00:00:00 2001 From: Abubeker Mohammed Date: Sat, 13 Aug 2022 23:34:12 -0400 Subject: [PATCH 3/5] TST: GH39984 Addition to tests --- pandas/tests/indexes/multi/test_constructors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/indexes/multi/test_constructors.py b/pandas/tests/indexes/multi/test_constructors.py index d99bcd97d2333..0cfeb99bba5de 100644 --- a/pandas/tests/indexes/multi/test_constructors.py +++ b/pandas/tests/indexes/multi/test_constructors.py @@ -5,7 +5,6 @@ import itertools import numpy as np -import pyarrow as pa import pytest from pandas.compat import pa_version_under1p01 @@ -650,10 +649,11 @@ def test_from_frame(): result = MultiIndex.from_frame(df) tm.assert_index_equal(expected, result) - + @pytest.mark.skipif(pa_version_under1p01) def test_from_frame_missing_values_multiIndex(): # GH 39984 + import pyarrow as pa df = pd.DataFrame( { "a": Series([1, 2, None], dtype="Int64"), From 53c7047454602b1114e54fc85f3474687521141a Mon Sep 17 00:00:00 2001 From: Abubeker Mohammed Date: Mon, 15 Aug 2022 16:46:12 -0400 Subject: [PATCH 4/5] TST: GH39984 Addition to tests --- pandas/tests/indexes/multi/test_constructors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/tests/indexes/multi/test_constructors.py b/pandas/tests/indexes/multi/test_constructors.py index 0cfeb99bba5de..9b0d70794adbe 100644 --- a/pandas/tests/indexes/multi/test_constructors.py +++ b/pandas/tests/indexes/multi/test_constructors.py @@ -654,6 +654,7 @@ def test_from_frame(): def test_from_frame_missing_values_multiIndex(): # GH 39984 import pyarrow as pa + df = pd.DataFrame( { "a": Series([1, 2, None], dtype="Int64"), From ca2360079b3439a1311ceaf190d7889cbe021290 Mon Sep 17 00:00:00 2001 From: BarkotBeyene Date: Tue, 16 Aug 2022 14:46:38 -0500 Subject: [PATCH 5/5] TST: GH39984 Addition to tests --- pandas/tests/indexes/multi/test_constructors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/indexes/multi/test_constructors.py b/pandas/tests/indexes/multi/test_constructors.py index 9b0d70794adbe..4dc3c5a4ae8b9 100644 --- a/pandas/tests/indexes/multi/test_constructors.py +++ b/pandas/tests/indexes/multi/test_constructors.py @@ -650,7 +650,7 @@ def test_from_frame(): tm.assert_index_equal(expected, result) -@pytest.mark.skipif(pa_version_under1p01) +@pytest.mark.skipif(pa_version_under1p01, reason="Import Problem") def test_from_frame_missing_values_multiIndex(): # GH 39984 import pyarrow as pa