Skip to content

Commit 2e2a0d8

Browse files
ShaharNavehJulianWgs
authored andcommitted
TST: Regression test for pandas-dev#33765 (pandas-dev#41169)
1 parent d2da352 commit 2e2a0d8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pandas/tests/frame/test_arithmetic.py

+20
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import pandas as pd
1313
from pandas import (
1414
DataFrame,
15+
Index,
1516
MultiIndex,
1617
Series,
1718
)
@@ -1816,3 +1817,22 @@ def test_inplace_arithmetic_series_update():
18161817

18171818
expected = DataFrame({"A": [2, 3, 4]})
18181819
tm.assert_frame_equal(df, expected)
1820+
1821+
1822+
def test_arithemetic_multiindex_align():
1823+
"""
1824+
Regression test for: https://github.com/pandas-dev/pandas/issues/33765
1825+
"""
1826+
df1 = DataFrame(
1827+
[[1]],
1828+
index=["a"],
1829+
columns=MultiIndex.from_product([[0], [1]], names=["a", "b"]),
1830+
)
1831+
df2 = DataFrame([[1]], index=["a"], columns=Index([0], name="a"))
1832+
expected = DataFrame(
1833+
[[0]],
1834+
index=["a"],
1835+
columns=MultiIndex.from_product([[0], [1]], names=["a", "b"]),
1836+
)
1837+
result = df1 - df2
1838+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)