Skip to content

Commit 64e7859

Browse files
BarkotBeyeneAbubeker Mohammed
and
Abubeker Mohammed
authored
TST: GH39984 Addition to tests (#48042)
* TST: GH39984 Addition to tests * TST: GH39984 Addition to tests * TST: GH39984 Addition to tests * TST: GH39984 Addition to tests * TST: GH39984 Addition to tests Co-authored-by: Abubeker Mohammed <[email protected]>
1 parent 4aa6c06 commit 64e7859

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pandas/tests/indexes/multi/test_constructors.py

+24
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import numpy as np
88
import pytest
99

10+
from pandas.compat import pa_version_under1p01
11+
1012
from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
1113

1214
import pandas as pd
@@ -648,6 +650,28 @@ def test_from_frame():
648650
tm.assert_index_equal(expected, result)
649651

650652

653+
@pytest.mark.skipif(pa_version_under1p01, reason="Import Problem")
654+
def test_from_frame_missing_values_multiIndex():
655+
# GH 39984
656+
import pyarrow as pa
657+
658+
df = pd.DataFrame(
659+
{
660+
"a": Series([1, 2, None], dtype="Int64"),
661+
"b": pd.Float64Dtype().__from_arrow__(pa.array([0.2, np.nan, None])),
662+
}
663+
)
664+
multi_indexed = MultiIndex.from_frame(df)
665+
expected = MultiIndex.from_arrays(
666+
[
667+
Series([1, 2, None]).astype("Int64"),
668+
pd.Float64Dtype().__from_arrow__(pa.array([0.2, np.nan, None])),
669+
],
670+
names=["a", "b"],
671+
)
672+
tm.assert_index_equal(multi_indexed, expected)
673+
674+
651675
@pytest.mark.parametrize(
652676
"non_frame",
653677
[

0 commit comments

Comments
 (0)