Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: GH39984 Addition to tests #47981

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions pandas/tests/indexes/multi/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import itertools

import numpy as np
import pyarrow as pa
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
Expand Down Expand Up @@ -648,6 +651,26 @@ def test_from_frame():
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",
[
Expand Down