16
16
from pandas .tests .copy_view .util import get_array
17
17
18
18
19
- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
20
19
def test_concat_frames (using_copy_on_write ):
21
- df = DataFrame ({"b" : ["a" ] * 3 })
22
- df2 = DataFrame ({"a" : ["a" ] * 3 })
20
+ df = DataFrame ({"b" : ["a" ] * 3 }, dtype = object )
21
+ df2 = DataFrame ({"a" : ["a" ] * 3 }, dtype = object )
23
22
df_orig = df .copy ()
24
23
result = concat ([df , df2 ], axis = 1 )
25
24
@@ -41,10 +40,9 @@ def test_concat_frames(using_copy_on_write):
41
40
tm .assert_frame_equal (df , df_orig )
42
41
43
42
44
- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
45
43
def test_concat_frames_updating_input (using_copy_on_write ):
46
- df = DataFrame ({"b" : ["a" ] * 3 })
47
- df2 = DataFrame ({"a" : ["a" ] * 3 })
44
+ df = DataFrame ({"b" : ["a" ] * 3 }, dtype = object )
45
+ df2 = DataFrame ({"a" : ["a" ] * 3 }, dtype = object )
48
46
result = concat ([df , df2 ], axis = 1 )
49
47
50
48
if using_copy_on_write :
@@ -203,7 +201,7 @@ def test_concat_copy_keyword(using_copy_on_write, copy):
203
201
assert not np .shares_memory (get_array (df2 , "b" ), get_array (result , "b" ))
204
202
205
203
206
- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
204
+ # @pytest.mark.xfail(using_string_dtype() and HAS_PYARROW, reason="TODO(infer_string)")
207
205
@pytest .mark .parametrize (
208
206
"func" ,
209
207
[
@@ -212,8 +210,8 @@ def test_concat_copy_keyword(using_copy_on_write, copy):
212
210
],
213
211
)
214
212
def test_merge_on_key (using_copy_on_write , func ):
215
- df1 = DataFrame ({"key" : ["a" , "b" , "c" ], "a" : [1 , 2 , 3 ]})
216
- df2 = DataFrame ({"key" : ["a" , "b" , "c" ], "b" : [4 , 5 , 6 ]})
213
+ df1 = DataFrame ({"key" : Series ( ["a" , "b" , "c" ], dtype = object ) , "a" : [1 , 2 , 3 ]})
214
+ df2 = DataFrame ({"key" : Series ( ["a" , "b" , "c" ], dtype = object ) , "b" : [4 , 5 , 6 ]})
217
215
df1_orig = df1 .copy ()
218
216
df2_orig = df2 .copy ()
219
217
@@ -267,7 +265,6 @@ def test_merge_on_index(using_copy_on_write):
267
265
tm .assert_frame_equal (df2 , df2_orig )
268
266
269
267
270
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
271
268
@pytest .mark .parametrize (
272
269
"func, how" ,
273
270
[
@@ -276,8 +273,8 @@ def test_merge_on_index(using_copy_on_write):
276
273
],
277
274
)
278
275
def test_merge_on_key_enlarging_one (using_copy_on_write , func , how ):
279
- df1 = DataFrame ({"key" : ["a" , "b" , "c" ], "a" : [1 , 2 , 3 ]})
280
- df2 = DataFrame ({"key" : ["a" , "b" ], "b" : [4 , 5 ]})
276
+ df1 = DataFrame ({"key" : Series ( ["a" , "b" , "c" ], dtype = object ) , "a" : [1 , 2 , 3 ]})
277
+ df2 = DataFrame ({"key" : Series ( ["a" , "b" ], dtype = object ) , "b" : [4 , 5 ]})
281
278
df1_orig = df1 .copy ()
282
279
df2_orig = df2 .copy ()
283
280
@@ -321,9 +318,13 @@ def test_merge_copy_keyword(using_copy_on_write, copy):
321
318
assert not np .shares_memory (get_array (df2 , "b" ), get_array (result , "b" ))
322
319
323
320
324
- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
321
+ @pytest .mark .xfail (
322
+ using_string_dtype () and HAS_PYARROW ,
323
+ reason = "TODO(infer_string); result.index infers str dtype while both "
324
+ "df1 and df2 index are object." ,
325
+ )
325
326
def test_join_on_key (using_copy_on_write ):
326
- df_index = Index (["a" , "b" , "c" ], name = "key" )
327
+ df_index = Index (["a" , "b" , "c" ], name = "key" , dtype = object )
327
328
328
329
df1 = DataFrame ({"a" : [1 , 2 , 3 ]}, index = df_index .copy (deep = True ))
329
330
df2 = DataFrame ({"b" : [4 , 5 , 6 ]}, index = df_index .copy (deep = True ))
@@ -355,9 +356,8 @@ def test_join_on_key(using_copy_on_write):
355
356
tm .assert_frame_equal (df2 , df2_orig )
356
357
357
358
358
- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
359
359
def test_join_multiple_dataframes_on_key (using_copy_on_write ):
360
- df_index = Index (["a" , "b" , "c" ], name = "key" )
360
+ df_index = Index (["a" , "b" , "c" ], name = "key" , dtype = object )
361
361
362
362
df1 = DataFrame ({"a" : [1 , 2 , 3 ]}, index = df_index .copy (deep = True ))
363
363
dfs_list = [
0 commit comments