I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
(note that this requires the gsw library to be installed)
>>> import gsw >>> import pandas as pd >>> gsw.SA_from_SP(pd.Series([30,30,30]), pd.Series([1000,1000,1000]), 0, 0) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/abarna/.pyenv/versions/gsw/lib/python3.8/site-packages/gsw/_utilities.py", line 62, in wrapper ret = f(*newargs, **kw) File "/Users/abarna/.pyenv/versions/gsw/lib/python3.8/site-packages/gsw/_wrapped_ufuncs.py", line 3245, in SA_from_SP return _gsw_ufuncs.sa_from_sp(SP, p, lon, lat) File "/Users/abarna/.pyenv/versions/gsw/lib/python3.8/site-packages/pandas/core/generic.py", line 1935, in __array_ufunc__ return arraylike.array_ufunc(self, ufunc, method, *inputs, **kwargs) File "/Users/abarna/.pyenv/versions/gsw/lib/python3.8/site-packages/pandas/core/arraylike.py", line 284, in array_ufunc raise NotImplementedError( NotImplementedError: Cannot apply ufunc <ufunc 'sa_from_sp'> to mixed DataFrame and Series inputs.Problem description
My group uses pandas with the gsw library to do some oceanographic calculations. gsw provides ufuncs to do these calculations. When more than one pd.Series is mixed with the scalar arguments at the end, it results in the NotImplementedError you see above. Also, gsw library itself was only recently updated to defer to the input's __array_ufunc__
method if it is present.
This is the result of some manual broadcasting:
>>> gsw.SA_from_SP(pd.Series([30,30,30]), pd.Series([1000,1000,1000]), pd.Series([0, 0, 0]), pd.Series([0, 0, 0])) 0 30.145599 1 30.145599 2 30.145599 dtype: float64Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 7d32926
python : 3.8.2.final.0
python-bits : 64
OS : Darwin
OS-release : 20.3.0
Version : Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/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.2.2
numpy : 1.20.1
pytz : 2021.1
dateutil : 2.8.1
pip : 19.2.3
setuptools : 41.2.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4