Skip to content

Commit 7380624

Browse files
author
Krzysztof Chomski
committed
BUG: fillna maximum recursion depth exceeded in cmp (GH18159).
1 parent 1647a72 commit 7380624

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

doc/source/whatsnew/v0.21.1.txt

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Bug Fixes
6464
- Bug in ``pd.concat`` when empty and non-empty DataFrames or Series are concatenated (:issue:`18178` :issue:`18187`)
6565
- Bug in :class:`IntervalIndex` constructor when a list of intervals is passed with non-default ``closed`` (:issue:`18334`)
6666
- Bug in :meth:`IntervalIndex.copy` when copying and ``IntervalIndex`` with non-default ``closed`` (:issue:`18339`)
67+
- Bug in :meth:`fillna` maximum recursion depth exceeded in cmp (:issue:`18159`).
6768

6869
Conversion
6970
^^^^^^^^^^

pandas/core/internals.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1847,8 +1847,9 @@ def _can_hold_element(self, element):
18471847
if tipo is not None:
18481848
return (issubclass(tipo.type, (np.floating, np.integer)) and
18491849
not issubclass(tipo.type, (np.datetime64, np.timedelta64)))
1850-
return (isinstance(element, (float, int, np.floating, np.int_)) and
1851-
not isinstance(element, (bool, np.bool_, datetime, timedelta,
1850+
return (
1851+
isinstance(element, (float, int, np.floating, np.int_, np.long))
1852+
and not isinstance(element, (bool, np.bool_, datetime, timedelta,
18521853
np.datetime64, np.timedelta64)))
18531854

18541855
def to_native_types(self, slicer=None, na_rep='', float_format=None,

pandas/tests/internals/test_internals.py

+1
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,7 @@ class TestCanHoldElement(object):
12221222
@pytest.mark.parametrize('value, dtype', [
12231223
(1, 'i8'),
12241224
(1.0, 'f8'),
1225+
(2**63, 'f8'),
12251226
(1j, 'complex128'),
12261227
(True, 'bool'),
12271228
(np.timedelta64(20, 'ns'), '<m8[ns]'),

0 commit comments

Comments
 (0)