@@ -1726,10 +1726,10 @@ def column_op(a, b):
17261726
17271727
17281728def _combine_series_frame (self , other , func , fill_value = None , axis = None ,
1729- level = None , try_cast = True ):
1729+ level = None ):
17301730 """
17311731 Apply binary operator `func` to self, other using alignment and fill
1732- conventions determined by the fill_value, axis, level, and try_cast kwargs.
1732+ conventions determined by the fill_value, axis, and level kwargs.
17331733
17341734 Parameters
17351735 ----------
@@ -1739,7 +1739,6 @@ def _combine_series_frame(self, other, func, fill_value=None, axis=None,
17391739 fill_value : object, default None
17401740 axis : {0, 1, 'columns', 'index', None}, default None
17411741 level : int or None, default None
1742- try_cast : bool, default True
17431742
17441743 Returns
17451744 -------
@@ -1754,8 +1753,7 @@ def _combine_series_frame(self, other, func, fill_value=None, axis=None,
17541753 if axis == 0 :
17551754 return self ._combine_match_index (other , func , level = level )
17561755 else :
1757- return self ._combine_match_columns (other , func , level = level ,
1758- try_cast = try_cast )
1756+ return self ._combine_match_columns (other , func , level = level )
17591757 else :
17601758 if not len (other ):
17611759 return self * np .nan
@@ -1766,8 +1764,7 @@ def _combine_series_frame(self, other, func, fill_value=None, axis=None,
17661764 columns = self .columns )
17671765
17681766 # default axis is columns
1769- return self ._combine_match_columns (other , func , level = level ,
1770- try_cast = try_cast )
1767+ return self ._combine_match_columns (other , func , level = level )
17711768
17721769
17731770def _align_method_FRAME (left , right , axis ):
@@ -1867,13 +1864,13 @@ def f(self, other, axis=default_axis, level=None, fill_value=None):
18671864 pass_op = op if axis in [0 , "columns" , None ] else na_op
18681865 return _combine_series_frame (self , other , pass_op ,
18691866 fill_value = fill_value , axis = axis ,
1870- level = level , try_cast = True )
1867+ level = level )
18711868 else :
18721869 if fill_value is not None :
18731870 self = self .fillna (fill_value )
18741871
18751872 assert np .ndim (other ) == 0
1876- return self ._combine_const (other , op , try_cast = True )
1873+ return self ._combine_const (other , op )
18771874
18781875 f .__name__ = op_name
18791876
@@ -1909,9 +1906,10 @@ def f(self, other, axis=default_axis, level=None):
19091906 elif isinstance (other , ABCSeries ):
19101907 return _combine_series_frame (self , other , na_op ,
19111908 fill_value = None , axis = axis ,
1912- level = level , try_cast = False )
1909+ level = level )
19131910 else :
1914- return self ._combine_const (other , na_op , try_cast = False )
1911+ assert np .ndim (other ) == 0 , other
1912+ return self ._combine_const (other , na_op )
19151913
19161914 f .__name__ = op_name
19171915
@@ -1937,14 +1935,13 @@ def f(self, other):
19371935 elif isinstance (other , ABCSeries ):
19381936 return _combine_series_frame (self , other , func ,
19391937 fill_value = None , axis = None ,
1940- level = None , try_cast = False )
1938+ level = None )
19411939 else :
19421940
19431941 # straight boolean comparisons we want to allow all columns
19441942 # (regardless of dtype to pass thru) See #4537 for discussion.
19451943 res = self ._combine_const (other , func ,
1946- errors = 'ignore' ,
1947- try_cast = False )
1944+ errors = 'ignore' )
19481945 return res .fillna (True ).astype (bool )
19491946
19501947 f .__name__ = op_name
@@ -1991,13 +1988,13 @@ def f(self, other, axis=None):
19911988 self ._get_axis_number (axis )
19921989
19931990 if isinstance (other , self ._constructor ):
1994- return self ._compare_constructor (other , na_op , try_cast = False )
1991+ return self ._compare_constructor (other , na_op )
19951992 elif isinstance (other , (self ._constructor_sliced , ABCDataFrame ,
19961993 ABCSeries )):
19971994 raise Exception ("input needs alignment for this object [{object}]"
19981995 .format (object = self ._constructor ))
19991996 else :
2000- return self ._combine_const (other , na_op , try_cast = False )
1997+ return self ._combine_const (other , na_op )
20011998
20021999 f .__name__ = op_name
20032000
0 commit comments