@@ -426,12 +426,16 @@ def test_downcast(self):
426
426
427
427
# cannot cast to an integer (signed or unsigned)
428
428
# because we have a float number
429
- data = ['1.1' , 2 , 3 ]
430
- expected = np .array ([1.1 , 2 , 3 ], dtype = np .float64 )
429
+ data = (['1.1' , 2 , 3 ],
430
+ [10000.0 , 20000 , 3000 , 40000.36 , 50000 , 50000.00 ])
431
+ expected = (np .array ([1.1 , 2 , 3 ], dtype = np .float64 ),
432
+ np .array ([10000.0 , 20000 , 3000 ,
433
+ 40000.36 , 50000 , 50000.00 ], dtype = np .float64 ))
431
434
432
- for downcast in ('integer' , 'signed' , 'unsigned' ):
433
- res = pd .to_numeric (data , downcast = downcast )
434
- tm .assert_numpy_array_equal (res , expected )
435
+ for _data , _expected in zip (data , expected ):
436
+ for downcast in ('integer' , 'signed' , 'unsigned' ):
437
+ res = pd .to_numeric (_data , downcast = downcast )
438
+ tm .assert_numpy_array_equal (res , _expected )
435
439
436
440
# the smallest integer dtype need not be np.(u)int8
437
441
data = ['256' , 257 , 258 ]
@@ -459,8 +463,7 @@ def test_downcast_limits(self):
459
463
('uint8' , u , [iinfo (np .uint8 ).min , iinfo (np .uint8 ).max ]),
460
464
('uint16' , u , [iinfo (np .uint16 ).min , iinfo (np .uint16 ).max ]),
461
465
('uint32' , u , [iinfo (np .uint32 ).min , iinfo (np .uint32 ).max ]),
462
- # Test will be skipped until there is more uint64 support.
463
- # ('uint64', u, [iinfo(uint64).min, iinfo(uint64).max]),
466
+ ('uint64' , u , [iinfo (np .uint64 ).min , iinfo (np .uint64 ).max ]),
464
467
('int16' , i , [iinfo (np .int8 ).min , iinfo (np .int8 ).max + 1 ]),
465
468
('int32' , i , [iinfo (np .int16 ).min , iinfo (np .int16 ).max + 1 ]),
466
469
('int64' , i , [iinfo (np .int32 ).min , iinfo (np .int32 ).max + 1 ]),
@@ -469,8 +472,7 @@ def test_downcast_limits(self):
469
472
('int64' , i , [iinfo (np .int32 ).min - 1 , iinfo (np .int64 ).max ]),
470
473
('uint16' , u , [iinfo (np .uint8 ).min , iinfo (np .uint8 ).max + 1 ]),
471
474
('uint32' , u , [iinfo (np .uint16 ).min , iinfo (np .uint16 ).max + 1 ]),
472
- # Test will be skipped until there is more uint64 support.
473
- # ('uint64', u, [iinfo(np.uint32).min, iinfo(np.uint32).max + 1]),
475
+ ('uint64' , u , [iinfo (np .uint32 ).min , iinfo (np .uint32 ).max + 1 ])
474
476
]
475
477
476
478
for dtype , downcast , min_max in dtype_downcast_min_max :
0 commit comments