@@ -335,18 +335,20 @@ def test_on_bad_lines_dtype_conversion_skip(c_parser_only, on_bad_lines, should_
335335 ):
336336 result = parser .read_csv (
337337 StringIO (data ),
338- dtype = {"col1" : int , "col2" : int , "col3" : int },
338+ dtype = {"col1" : np . int64 , "col2" : np . int64 , "col3" : np . int64 },
339339 on_bad_lines = on_bad_lines ,
340340 )
341341 else :
342342 result = parser .read_csv (
343343 StringIO (data ),
344- dtype = {"col1" : int , "col2" : int , "col3" : int },
344+ dtype = {"col1" : np . int64 , "col2" : np . int64 , "col3" : np . int64 },
345345 on_bad_lines = on_bad_lines ,
346346 )
347347
348348 # Row with 'a' cannot convert to int, should be skipped
349- expected = DataFrame ({"col1" : [1 , 4 ], "col2" : [2 , 5 ], "col3" : [3 , 6 ]})
349+ expected = DataFrame (
350+ {"col1" : [1 , 4 ], "col2" : [2 , 5 ], "col3" : [3 , 6 ]}, dtype = np .int64
351+ )
350352 tm .assert_frame_equal (result , expected )
351353
352354
@@ -358,7 +360,7 @@ def test_on_bad_lines_dtype_conversion_error(c_parser_only):
358360 with pytest .raises (ValueError , match = "invalid literal for int" ):
359361 parser .read_csv (
360362 StringIO (data ),
361- dtype = {"col1" : int , "col2" : int },
363+ dtype = {"col1" : np . int64 , "col2" : np . int64 },
362364 on_bad_lines = "error" ,
363365 )
364366
@@ -385,11 +387,13 @@ def test_on_bad_lines_dtype_partial_columns(c_parser_only):
385387
386388 result = parser .read_csv (
387389 StringIO (data ),
388- dtype = {"a" : int , "c" : int },
390+ dtype = {"a" : np . int64 , "c" : np . int64 },
389391 on_bad_lines = "skip" ,
390392 )
391393
392- expected = DataFrame ({"a" : [1 , 4 ], "b" : ["hello" , "test" ], "c" : [3 , 9 ]})
394+ expected = DataFrame (
395+ {"a" : np .array ([1 , 4 ], dtype = np .int64 ), "b" : ["hello" , "test" ], "c" : np .array ([3 , 9 ], dtype = np .int64 )}
396+ )
393397 tm .assert_frame_equal (result , expected )
394398
395399
@@ -400,11 +404,11 @@ def test_on_bad_lines_dtype_mixed_errors(c_parser_only):
400404
401405 result = parser .read_csv (
402406 StringIO (data ),
403- dtype = {"a" : int , "b" : int , "c" : int },
407+ dtype = {"a" : np . int64 , "b" : np . int64 , "c" : np . int64 },
404408 on_bad_lines = "skip" ,
405409 )
406410
407- expected = DataFrame ({"a" : [1 , 6 ], "b" : [2 , 7 ], "c" : [3 , 8 ]})
411+ expected = DataFrame ({"a" : [1 , 6 ], "b" : [2 , 7 ], "c" : [3 , 8 ]}, dtype = np . int64 )
408412 tm .assert_frame_equal (result , expected )
409413
410414
@@ -415,9 +419,9 @@ def test_on_bad_lines_dtype_all_bad_rows(c_parser_only):
415419
416420 result = parser .read_csv (
417421 StringIO (data ),
418- dtype = {"a" : int , "b" : int },
422+ dtype = {"a" : np . int64 , "b" : np . int64 },
419423 on_bad_lines = "skip" ,
420424 )
421425
422- expected = DataFrame ({"a" : [], "b" : []}).astype (int )
426+ expected = DataFrame ({"a" : [], "b" : []}).astype (np . int64 )
423427 tm .assert_frame_equal (result , expected )
0 commit comments