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
ser = pd.Series([0.0, 17.3])
np.log(ser, where=ser != 0) # Crashes, but used to work
Issue Description
Using pandas 2.1.0 the example has been working fine until using numpy version 1.24.4. Tested now using numpy 1.25.2 and it also crashes. If instead converting the mask to numpy beforehand the example runs fine.
Since it works with numpy's native datatype I filed the issue here rather than at numpy.
Expected Behavior
import pandas as pd
import numpy as np
ser = pd.Series([0.0, 17.3])
np.log(ser, where=(ser != 0).values) # works
Installed Versions
pandas : 2.1.0
numpy : 1.25.2
pytz : 2022.1
dateutil : 2.8.2
setuptools : 59.6.0
pip : 22.0.2
Cython : None
pytest : 7.2.2
hypothesis : None
sphinx : 6.1.3
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.8.0
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.0.3
IPython : 7.31.1
pandas_datareader : None
bs4 : 4.10.0
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : 2023.4.0
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : 2.3.0
pyqt5 : None
/usr/lib/python3/dist-packages/scipy/init.py:146: UserWarning: A NumPy version >=1.17.3 and <1.25.0 is required for this version of SciPy (detected version 1.25.2
warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"