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
Krzysztof Chomski committed Nov 20, 2017
1 parent 3b05a60 commit 54303dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.22.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Documentation Changes
Bug Fixes
~~~~~~~~~

- BUG: fillna maximum recursion depth exceeded in cmp (GH18159).

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_, np.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 54303dd

Please sign in to comment.