@@ -217,42 +217,14 @@ def _cast_pointwise_result(self, op_name: str, obj, other, pointwise_result):
217217 sdtype = tm .get_dtype (obj )
218218 expected = pointwise_result
219219
220- if op_name in ("eq" , "ne" , "le" , "ge" , "lt" , "gt" ):
221- return expected .astype ("boolean" )
222-
223- if sdtype .kind in "iu" :
224- if op_name in ("__rtruediv__" , "__truediv__" , "__div__" ):
225- filled = expected .fillna (np .nan )
226- expected = filled .astype ("Float64" )
227- else :
228- # combine method result in 'biggest' (int64) dtype
229- expected = expected .astype (sdtype )
230- elif sdtype .kind == "b" :
220+ if sdtype .kind == "b" :
231221 if op_name in (
232- "__floordiv__" ,
233- "__rfloordiv__" ,
234- "__pow__" ,
235- "__rpow__" ,
236222 "__mod__" ,
237223 "__rmod__" ,
238224 ):
239225 # combine keeps boolean type
240226 expected = expected .astype ("Int8" )
241227
242- elif op_name in ("__truediv__" , "__rtruediv__" ):
243- # combine with bools does not generate the correct result
244- # (numpy behaviour for div is to regard the bools as numeric)
245- op = self .get_op_from_name (op_name )
246- expected = self ._combine (obj .astype (float ), other , op )
247- expected = expected .astype ("Float64" )
248-
249- if op_name == "__rpow__" :
250- # for rpow, combine does not propagate NaN
251- result = getattr (obj , op_name )(other )
252- expected [result .isna ()] = np .nan
253- else :
254- # combine method result in 'biggest' (float64) dtype
255- expected = expected .astype (sdtype )
256228 return expected
257229
258230 def test_divmod_series_array (self , data , data_for_twos , request ):
0 commit comments