@@ -1843,9 +1843,7 @@ def test_merge_empty(self, left_empty, how, exp):
1843
1843
1844
1844
tm .assert_frame_equal (result , expected )
1845
1845
1846
- def test_merge_with_uintc_columns (dataframes_with_uintc ):
1847
- """To test if pd.merge works with numpy.uintc on windows"""
1848
-
1846
+ def test_merge_with_uintc_columns (self ):
1849
1847
df1 = pd .DataFrame ({"a" : ["foo" , "bar" ], "b" : np .array ([1 , 2 ], dtype = np .uintc )})
1850
1848
df2 = pd .DataFrame ({"a" : ["foo" , "baz" ], "b" : np .array ([3 , 4 ], dtype = np .uintc )})
1851
1849
result = df1 .merge (df2 , how = "outer" )
@@ -1856,6 +1854,32 @@ def test_merge_with_uintc_columns(dataframes_with_uintc):
1856
1854
}
1857
1855
)
1858
1856
tm .assert_frame_equal (result .reset_index (drop = True ), expected )
1857
+
1858
+ def test_merge_with_intc_columns (self ):
1859
+ df1 = pd .DataFrame ({"a" : ["foo" , "bar" ], "b" : np .array ([1 , 2 ], dtype = np .intc )})
1860
+ df2 = pd .DataFrame ({"a" : ["foo" , "baz" ], "b" : np .array ([3 , 4 ], dtype = np .intc )})
1861
+ result = df1 .merge (df2 , how = "outer" )
1862
+ expected = pd .DataFrame (
1863
+ {
1864
+ "a" : ["bar" , "baz" , "foo" , "foo" ],
1865
+ "b" : np .array ([2 , 4 , 1 , 3 ], dtype = np .intc ),
1866
+ }
1867
+ )
1868
+ tm .assert_frame_equal (result .reset_index (drop = True ), expected )
1869
+
1870
+ def test_merge_intc_non_monotonic (self ):
1871
+ df = pd .DataFrame ({"join_key" : pd .Series ([0 , 2 , 1 ], dtype = np .intc )})
1872
+ df_details = pd .DataFrame ({"join_key" : pd .Series ([0 , 1 , 2 ], dtype = np .intc ),"value" : ["a" , "b" , "c" ]})
1873
+ merged = pd .merge (df , df_details , on = "join_key" , how = "left" )
1874
+ expected = pd .DataFrame (
1875
+ {
1876
+ 'join_key' :np .array ([0 ,2 ,1 ],dtype = np .intc ),
1877
+ 'value' :['a' ,'c' ,'b' ]
1878
+ }
1879
+ )
1880
+ tm .assert_frame_equal (merged .reset_index (drop = True ),expected )
1881
+
1882
+
1859
1883
1860
1884
1861
1885
@pytest .fixture
0 commit comments