@@ -139,19 +139,26 @@ def time_dtype_infer_uint32(self):
139139
140140
141141class to_numeric (object ):
142+
143+ param_names = ['dtype' , 'downcast' ]
144+ params = [['string-float' , 'string-int' , 'string-nint' , 'datetime64' ,
145+ 'int-list' , 'int32' ],
146+ [None , 'integer' , 'signed' , 'unsigned' , 'float' ]]
147+
142148 N = 500000
143149
144- param_names = ['data' , 'downcast' ]
145- params = [
146- [(['1' ] * (N / 2 )) + ([2 ] * (N / 2 )),
147- (['-1' ] * (N / 2 )) + ([2 ] * (N / 2 )),
148- np .repeat (np .array (['1970-01-01' , '1970-01-02' ],
149- dtype = 'datetime64[D]' ), N ),
150- (['1.1' ] * (N / 2 )) + ([2 ] * (N / 2 )),
151- ([1 ] * (N / 2 )) + ([2 ] * (N / 2 )),
152- np .repeat (np .int32 (1 ), N )],
153- [None , 'integer' , 'signed' , 'unsigned' , 'float' ],
154- ]
155-
156- def time_to_numeric (self , data , downcast ):
157- pd .to_numeric (data , downcast = downcast )
150+ data_dict = {
151+ 'string-int' : (['1' ] * (N / 2 )) + ([2 ] * (N / 2 )),
152+ 'string-nint' : (['-1' ] * (N / 2 )) + ([2 ] * (N / 2 )),
153+ 'datetime64' : np .repeat (np .array (['1970-01-01' , '1970-01-02' ],
154+ dtype = 'datetime64[D]' ), N ),
155+ 'string-float' : (['1.1' ] * (N / 2 )) + ([2 ] * (N / 2 )),
156+ 'int-list' : ([1 ] * (N / 2 )) + ([2 ] * (N / 2 )),
157+ 'int32' : np .repeat (np .int32 (1 ), N )
158+ }
159+
160+ def setup (self , dtype , downcast ):
161+ self .data = self .data_dict [dtype ]
162+
163+ def time_downcast (self , dtype , downcast ):
164+ pd .to_numeric (self .data , downcast = downcast )
0 commit comments