Skip to content

Commit

Permalink
TST: Merge multiple cols with mixed columns/index (#29522)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankarlos authored and jreback committed Nov 16, 2019
1 parent 7a13fc4 commit a9abadc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pandas/tests/reshape/merge/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,27 @@ def test_merge_right_vs_left(self, left, right, sort):

tm.assert_frame_equal(merged_left_right, merge_right_left)

def test_merge_multiple_cols_with_mixed_cols_index(self):
# GH29522
s = pd.Series(
range(6),
pd.MultiIndex.from_product([["A", "B"], [1, 2, 3]], names=["lev1", "lev2"]),
name="Amount",
)
df = pd.DataFrame(
{"lev1": list("AAABBB"), "lev2": [1, 2, 3, 1, 2, 3], "col": 0}
)
result = pd.merge(df, s.reset_index(), on=["lev1", "lev2"])
expected = pd.DataFrame(
{
"lev1": list("AAABBB"),
"lev2": [1, 2, 3, 1, 2, 3],
"col": [0] * 6,
"Amount": range(6),
}
)
tm.assert_frame_equal(result, expected)

def test_compress_group_combinations(self):

# ~ 40000000 possible unique groups
Expand Down

0 comments on commit a9abadc

Please sign in to comment.