Skip to content

Commit

Permalink
BUG: fillna maximum recursion depth exceeded in cmp (GH18159).
Browse files Browse the repository at this point in the history
  • Loading branch information
gkonefal-reef committed Dec 3, 2017
1 parent 0e16818 commit f29a917
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.21.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Documentation Changes

Bug Fixes
~~~~~~~~~
- Bug in :meth:`fillna` where maximum recursion depth gets exceeded in comparison (:issue:`18159`).


Conversion
^^^^^^^^^^
Expand Down
5 changes: 3 additions & 2 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1847,8 +1847,9 @@ def _can_hold_element(self, element):
if tipo is not None:
return (issubclass(tipo.type, (np.floating, np.integer)) and
not issubclass(tipo.type, (np.datetime64, np.timedelta64)))
return (isinstance(element, (float, int, np.floating, np.int_)) and
not isinstance(element, (bool, np.bool_, datetime, timedelta,
return (
isinstance(element, (float, int, np.floating, np.int_, compat.long))
and not isinstance(element, (bool, np.bool_, datetime, timedelta,
np.datetime64, np.timedelta64)))

def to_native_types(self, slicer=None, na_rep='', float_format=None,
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/internals/test_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,7 @@ class TestCanHoldElement(object):
@pytest.mark.parametrize('value, dtype', [
(1, 'i8'),
(1.0, 'f8'),
(2**63, 'f8'),
(1j, 'complex128'),
(True, 'bool'),
(np.timedelta64(20, 'ns'), '<m8[ns]'),
Expand Down

0 comments on commit f29a917

Please sign in to comment.