@@ -197,6 +197,7 @@ def test_update_dt_column_with_NaT_create_column(self):
197197 np .datetime64 ("2000-01-02T00:00:00" ),
198198 np .dtype ("datetime64[ns]" ),
199199 ),
200+ (1 , 2 , pd .Int64Dtype ()),
200201 ],
201202 )
202203 def test_update_preserve_dtype (self , value_df , value_other , dtype ):
@@ -228,3 +229,19 @@ def test_update_on_duplicate_frame_unique_argument_index(self):
228229 expected = DataFrame ({"a" : [2 , 2 , 3 ]}, index = [1 , 1 , 2 ], dtype = np .dtype ("intc" ))
229230 df .update (other )
230231 tm .assert_frame_equal (df , expected )
232+
233+ def test_update_preserve_mixed_dtypes (self ):
234+ # GH#44104
235+ dtype1 = pd .Int64Dtype ()
236+ dtype2 = pd .StringDtype ()
237+ df = DataFrame ({"a" : [1 , 2 , 3 ], "b" : ["x" , "y" , "z" ]})
238+ df = df .astype ({"a" : dtype1 , "b" : dtype2 })
239+
240+ other = DataFrame ({"a" : [4 , 5 ], "b" : ["a" , "b" ]})
241+ other = other .astype ({"a" : dtype1 , "b" : dtype2 })
242+
243+ expected = DataFrame ({"a" : [4 , 5 , 3 ], "b" : ["a" , "b" , "z" ]})
244+ expected = expected .astype ({"a" : dtype1 , "b" : dtype2 })
245+
246+ df .update (other )
247+ tm .assert_frame_equal (df , expected )
0 commit comments