Skip to content

Commit 9918158

Browse files
sofiane87mroeschke
authored andcommitted
TST: Adding merge test for non-string columns [Ref 17962] (#29370)
* TST: Adding merge test for non-string columns [Ref 17962] * assign result before assert
1 parent 8c38b24 commit 9918158

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/reshape/merge/test_merge.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,18 @@ def test_merge_common(self):
134134
exp = merge(self.df, self.df2, on=["key1", "key2"])
135135
tm.assert_frame_equal(joined, exp)
136136

137+
def test_merge_non_string_columns(self):
138+
# https://github.com/pandas-dev/pandas/issues/17962
139+
# Checks that method runs for non string column names
140+
left = pd.DataFrame(
141+
{0: [1, 0, 1, 0], 1: [0, 1, 0, 0], 2: [0, 0, 2, 0], 3: [1, 0, 0, 3]}
142+
)
143+
144+
right = left.astype(float)
145+
expected = left
146+
result = pd.merge(left, right)
147+
tm.assert_frame_equal(expected, result)
148+
137149
def test_merge_index_as_on_arg(self):
138150
# GH14355
139151

0 commit comments

Comments
 (0)