@@ -1726,10 +1726,10 @@ def column_op(a, b):
1726
1726
1727
1727
1728
1728
def _combine_series_frame (self , other , func , fill_value = None , axis = None ,
1729
- level = None , try_cast = True ):
1729
+ level = None ):
1730
1730
"""
1731
1731
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.
1733
1733
1734
1734
Parameters
1735
1735
----------
@@ -1739,7 +1739,6 @@ def _combine_series_frame(self, other, func, fill_value=None, axis=None,
1739
1739
fill_value : object, default None
1740
1740
axis : {0, 1, 'columns', 'index', None}, default None
1741
1741
level : int or None, default None
1742
- try_cast : bool, default True
1743
1742
1744
1743
Returns
1745
1744
-------
@@ -1754,8 +1753,7 @@ def _combine_series_frame(self, other, func, fill_value=None, axis=None,
1754
1753
if axis == 0 :
1755
1754
return self ._combine_match_index (other , func , level = level )
1756
1755
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 )
1759
1757
else :
1760
1758
if not len (other ):
1761
1759
return self * np .nan
@@ -1766,8 +1764,7 @@ def _combine_series_frame(self, other, func, fill_value=None, axis=None,
1766
1764
columns = self .columns )
1767
1765
1768
1766
# 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 )
1771
1768
1772
1769
1773
1770
def _align_method_FRAME (left , right , axis ):
@@ -1867,13 +1864,13 @@ def f(self, other, axis=default_axis, level=None, fill_value=None):
1867
1864
pass_op = op if axis in [0 , "columns" , None ] else na_op
1868
1865
return _combine_series_frame (self , other , pass_op ,
1869
1866
fill_value = fill_value , axis = axis ,
1870
- level = level , try_cast = True )
1867
+ level = level )
1871
1868
else :
1872
1869
if fill_value is not None :
1873
1870
self = self .fillna (fill_value )
1874
1871
1875
1872
assert np .ndim (other ) == 0
1876
- return self ._combine_const (other , op , try_cast = True )
1873
+ return self ._combine_const (other , op )
1877
1874
1878
1875
f .__name__ = op_name
1879
1876
@@ -1909,9 +1906,10 @@ def f(self, other, axis=default_axis, level=None):
1909
1906
elif isinstance (other , ABCSeries ):
1910
1907
return _combine_series_frame (self , other , na_op ,
1911
1908
fill_value = None , axis = axis ,
1912
- level = level , try_cast = False )
1909
+ level = level )
1913
1910
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 )
1915
1913
1916
1914
f .__name__ = op_name
1917
1915
@@ -1937,14 +1935,13 @@ def f(self, other):
1937
1935
elif isinstance (other , ABCSeries ):
1938
1936
return _combine_series_frame (self , other , func ,
1939
1937
fill_value = None , axis = None ,
1940
- level = None , try_cast = False )
1938
+ level = None )
1941
1939
else :
1942
1940
1943
1941
# straight boolean comparisons we want to allow all columns
1944
1942
# (regardless of dtype to pass thru) See #4537 for discussion.
1945
1943
res = self ._combine_const (other , func ,
1946
- errors = 'ignore' ,
1947
- try_cast = False )
1944
+ errors = 'ignore' )
1948
1945
return res .fillna (True ).astype (bool )
1949
1946
1950
1947
f .__name__ = op_name
@@ -1991,13 +1988,13 @@ def f(self, other, axis=None):
1991
1988
self ._get_axis_number (axis )
1992
1989
1993
1990
if isinstance (other , self ._constructor ):
1994
- return self ._compare_constructor (other , na_op , try_cast = False )
1991
+ return self ._compare_constructor (other , na_op )
1995
1992
elif isinstance (other , (self ._constructor_sliced , ABCDataFrame ,
1996
1993
ABCSeries )):
1997
1994
raise Exception ("input needs alignment for this object [{object}]"
1998
1995
.format (object = self ._constructor ))
1999
1996
else :
2000
- return self ._combine_const (other , na_op , try_cast = False )
1997
+ return self ._combine_const (other , na_op )
2001
1998
2002
1999
f .__name__ = op_name
2003
2000
0 commit comments