Skip to content

Commit

Permalink
TST: Regression test for #33765 (#41169)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaharNaveh authored Apr 29, 2021
1 parent b60a82f commit 3c6f3cd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pandas/tests/frame/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
)
Expand Down Expand Up @@ -1816,3 +1817,22 @@ def test_inplace_arithmetic_series_update():

expected = DataFrame({"A": [2, 3, 4]})
tm.assert_frame_equal(df, expected)


def test_arithemetic_multiindex_align():
"""
Regression test for: https://github.com/pandas-dev/pandas/issues/33765
"""
df1 = DataFrame(
[[1]],
index=["a"],
columns=MultiIndex.from_product([[0], [1]], names=["a", "b"]),
)
df2 = DataFrame([[1]], index=["a"], columns=Index([0], name="a"))
expected = DataFrame(
[[0]],
index=["a"],
columns=MultiIndex.from_product([[0], [1]], names=["a", "b"]),
)
result = df1 - df2
tm.assert_frame_equal(result, expected)

0 comments on commit 3c6f3cd

Please sign in to comment.