You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C:\Python64\lib\site-packages\pandas\core\internals.pyc in where(self, other, cond, align, raise_on_error, try_cast)
1076 # see if we can operate on the entire block, or need item-by-item
1077 # or if we are a single block (ndim == 1)
-> 1078 result = func(cond, values, other)
1079 if self._can_hold_na or self.ndim == 1:
1080
C:\Python64\lib\site-packages\pandas\core\internals.pyc in func(c, v, o)
1059 return v
1060
-> 1061 v, o = self._try_coerce_args(v, o)
1062 try:
1063 return self._try_coerce_result(
C:\Python64\lib\site-packages\pandas\core\internals.pyc in _try_coerce_args(self, values, other)
1518 values is always ndarra like, other may not be """
1519 values = values.view('i8')
-> 1520 if isnull(other) or (np.isscalar(other) and other == tslib.iNaT):
1521 other = tslib.iNaT
1522 elif isinstance(other, datetime):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The issue I found is the "if" condition. When input other is array-like, isnull return and the second "or" condition won't have the same size. A potential fix could be changing line 1520 to:
if np.isscalar(other) and (isnull(other) or other == tslib.iNaT):
The text was updated successfully, but these errors were encountered:
When running the following example code, it throws error in DatatimeBlock._try_coerce_args()
ValueError Traceback (most recent call last)
in ()
----> 1 T1.where( ~T1.isnull(), other = T2)
C:\Python64\lib\site-packages\pandas\core\generic.pyc in where(self, cond, other, inplace, axis, level, try_cast, raise_on_error)
2887 new_data = self._data.where(other, cond, align=axis is None,
2888 raise_on_error=raise_on_error,
-> 2889 try_cast=try_cast)
2890
2891 return self._constructor(new_data).finalize(self)
C:\Python64\lib\site-packages\pandas\core\internals.pyc in where(self, _args, *_kwargs)
2279
2280 def where(self, _args, *_kwargs):
-> 2281 return self.apply('where', _args, *_kwargs)
2282
2283 def eval(self, _args, *_kwargs):
C:\Python64\lib\site-packages\pandas\core\internals.pyc in apply(self, f, _args, *_kwargs)
2265
2266 else:
-> 2267 applied = getattr(blk, f)(_args, *_kwargs)
2268
2269 if isinstance(applied, list):
C:\Python64\lib\site-packages\pandas\core\internals.pyc in where(self, other, cond, align, raise_on_error, try_cast)
1076 # see if we can operate on the entire block, or need item-by-item
1077 # or if we are a single block (ndim == 1)
-> 1078 result = func(cond, values, other)
1079 if self._can_hold_na or self.ndim == 1:
1080
C:\Python64\lib\site-packages\pandas\core\internals.pyc in func(c, v, o)
1059 return v
1060
-> 1061 v, o = self._try_coerce_args(v, o)
1062 try:
1063 return self._try_coerce_result(
C:\Python64\lib\site-packages\pandas\core\internals.pyc in _try_coerce_args(self, values, other)
1518 values is always ndarra like, other may not be """
1519 values = values.view('i8')
-> 1520 if isnull(other) or (np.isscalar(other) and other == tslib.iNaT):
1521 other = tslib.iNaT
1522 elif isinstance(other, datetime):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The issue I found is the "if" condition. When input other is array-like, isnull return and the second "or" condition won't have the same size. A potential fix could be changing line 1520 to:
if np.isscalar(other) and (isnull(other) or other == tslib.iNaT):
The text was updated successfully, but these errors were encountered: