You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
importpandasaspdimportpint_pandasfrompint_pandasimportPintArrayasPA_xx=pd.DataFrame(PA_([1.,2.,3.],dtype='pint[m]'))
yy=PA_([10.,10.,10.],dtype='pint[m]')
zz=PA_([0.,0.,0.],dtype='pint[m]')
# Clip 1,2,3 against lower bound of 10,10,10 results in 10,10,10xx.clip(lower=yy, axis=0)
# 0# 0 10.0# 1 10.0# 2 10.0# Clip 1,2,3 against lower bound of 0,0,0 should result in 1,2,3xx.clip(lower=zz, axis=0)
# *** IndexError: index 0 is out of bounds for axis 0 with size 0
Issue Description
This problem smacks of the recently merged regression identified here: #45778
But this is not a problem with the .loc indexer, but elsewhere. Most likely the where function in blocks.py, line 1634 in the 1.4.0 release. Maybe the fix is very simple: in function (def where(self, other, cond, errors="raise") -> list[Block]:
) replace
try:
result[icond] = set_other
with
try:
if icond.any():
result[icond] = set_other
Expected Behavior
I expect that a clip action that is supposed to do nothing will do nothing, not throw an error about a zero-sized array that's unable to handle a zero-sized update of nothingness.
Installed Versions
INSTALLED VERSIONS
commit : 66e3805
python : 3.9.9.final.0
python-bits : 64
OS : Darwin
OS-release : 21.3.0
Version : Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
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
Issue Description
This problem smacks of the recently merged regression identified here: #45778
But this is not a problem with the .loc indexer, but elsewhere. Most likely the
where
function in blocks.py, line 1634 in the 1.4.0 release. Maybe the fix is very simple: in function (def where(self, other, cond, errors="raise") -> list[Block]:) replace
with
Expected Behavior
I expect that a clip action that is supposed to do nothing will do nothing, not throw an error about a zero-sized array that's unable to handle a zero-sized update of nothingness.
Installed Versions
INSTALLED VERSIONS
commit : 66e3805
python : 3.9.9.final.0
python-bits : 64
OS : Darwin
OS-release : 21.3.0
Version : Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.5
numpy : 1.22.0
pytz : 2021.3
dateutil : 2.8.2
pip : 21.3.1
setuptools : 60.3.1
Cython : 0.29.26
pytest : None
hypothesis : None
sphinx : 4.3.2
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.31.0
pandas_datareader: None
bs4 : 4.10.0
bottleneck : 1.3.2
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : 2.8.0
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: