Skip to content

BUG: fillna maximum recursion depth exceeded in cmp #18159

Closed
reef-technologies/pandas
#5
@llchan

Description

@llchan

Code Sample, a copy-pastable example if possible

import pandas as pd
import numpy as np

s = pd.Series([float('nan')])
t = s.fillna(2 ** 63)         # RuntimeError: maximum recursion depth exceeded in cmp
t = s.fillna(float(2 ** 63))  # works

Problem description

A fillna call with a large integer causes infinite recursion. Converting to a float before passing it in seems to fix it. Maybe the arg of fillna should be converted to the series dtype immediately?

Note that this bug only affects PY2, PY3 works just fine.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.14.final.0
python-bits: 64
OS: Linux
OS-release: 3.x.x...x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None

pandas: 0.21.0
pytest: 3.2.3
pip: 9.0.1
setuptools: 36.6.0
Cython: 0.27.3
numpy: 1.13.3
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 5.4.1
sphinx: None
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: 1.1.15
pymysql: None
psycopg2: 2.7.3.2 (dt dec pq3 ext)
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: 0.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDtype ConversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions