diff --git a/pandas/tests/indexes/multi/test_constructors.py b/pandas/tests/indexes/multi/test_constructors.py index 7fad59fc6654c..4dc3c5a4ae8b9 100644 --- a/pandas/tests/indexes/multi/test_constructors.py +++ b/pandas/tests/indexes/multi/test_constructors.py @@ -7,6 +7,8 @@ import numpy as np import pytest +from pandas.compat import pa_version_under1p01 + from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike import pandas as pd @@ -648,6 +650,28 @@ def test_from_frame(): tm.assert_index_equal(expected, result) +@pytest.mark.skipif(pa_version_under1p01, reason="Import Problem") +def test_from_frame_missing_values_multiIndex(): + # GH 39984 + import pyarrow as pa + + 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", [