-
-
Notifications
You must be signed in to change notification settings - Fork 19k
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
import numpy as np
pd.DataFrame(dict(a=[np.nan, 1])).interpolate(method="nearest")
Issue Description
The example fails with a Scipy exception which says:
ValueError: x and y arrays must have at least 2 entries
The following examples all work as intended:
>>> pd.DataFrame(dict(a=[np.nan])).interpolate(method="nearest")
# a
# 0 NaN
>>> pd.DataFrame(dict(a=[np.nan, np.nan])).interpolate(method="nearest")
# a
# 0 NaN
# 1 NaN
>>> pd.DataFrame(dict(a=[np.nan, 1, 1 np.nan])).interpolate(method="nearest")
# a
# 0 NaN
# 1 1.0
# 2 1.0
# 3 NaN
Expected Behavior
>>> pd.DataFrame(dict(a=[np.nan, 1])).interpolate(method="nearest")
# a
# 0 NaN
# 1 1.0
Installed Versions
INSTALLED VERSIONS
commit : 06d2301
python : 3.10.2.final.0
python-bits : 64
OS : Linux
OS-release : 5.16.12-arch1-1
Version : #1 SMP PREEMPT Wed, 02 Mar 2022 12:22:51 +0000
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.1
numpy : 1.22.2
pytz : 2021.3
dateutil : 2.8.2
pip : 21.0
setuptools : 59.3.0
Cython : None
pytest : None
hypothesis : None
sphinx : 4.4.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.7.1
html5lib : 1.1
pymysql : None
psycopg2 : 2.9.3
jinja2 : 3.0.3
IPython : 8.1.0
pandas_datareader: 0.10.0
bs4 : None
bottleneck : None
fastparquet : None
fsspec : 2021.10.1
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 6.0.1
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
sqlalchemy : 1.4.30
tables : None
tabulate : 0.8.9
xarray : None
xlrd : None
xlwt : None
zstandard : None