fillna not throwing error when limit is not positive · Issue #27042 · pandas-dev/pandas (original) (raw)
Code Sample
import pandas as pd import numpy as np
Your code here
NCOLS = 3 NROWS = 50 data = {"col{}".format(int((i - NCOLS / 2) % NCOLS + 1)): np.random.randint( -100, 100, size=(NROWS) ) for i in range(NCOLS) } df = pd.dataframe(data) df.fillna(0, limit=-5)
Problem description
I am currently on pandas 0.24.2 and running the above code does not throw an error even though the limit is less than or equal to zero. This error does not arise when the data
is made up of floats instead of ints (replace np.random.randint
with np.random.uniform
).
Expected Output
ValueError: Limit must be greater than 0
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.1.final.0
python-bits: 64
OS: Darwin
OS-release: 18.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.24.2
pytest: 4.3.0
pip: 19.0.3
setuptools: 40.8.0
Cython: 0.29.7
numpy: 1.15.0
scipy: 1.2.1
pyarrow: 0.14.0.RAY
xarray: 0.12.0
IPython: 7.3.0
sphinx: None
patsy: None
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: 0.2.0
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None