Skip to content

Commit 5b66502

Browse files
Add test for MultiIndex.from_tuples (#52560)
* Add test for MultiIndex.from_tuples * Make changes in test_multiindex_from_tuples * Fix code check errors * Fix code style
1 parent dfae6db commit 5b66502

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/indexing/multiindex/test_multiindex.py

+8
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,11 @@ def test_multiindex_with_na_missing_key(self):
206206
)
207207
with pytest.raises(KeyError, match="missing_key"):
208208
df[[("missing_key",)]]
209+
210+
def test_multiindex_from_tuples_with_nan(self):
211+
# GH#23578
212+
result = MultiIndex.from_tuples([("a", "b", "c"), np.nan, ("d", "", "")])
213+
expected = MultiIndex.from_tuples(
214+
[("a", "b", "c"), (np.nan, np.nan, np.nan), ("d", "", "")]
215+
)
216+
tm.assert_index_equal(result, expected)

0 commit comments

Comments
 (0)