-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Binary operations (__and__, __or__, etc.) do not take parameter axis
and fail
#39519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
first bad commit is 7f1c3b1 cc @jbrockmendel |
|
It appears this was an intentional change #36796 (comment) |
@jorisvandenbossche potential discussion item for dev meeting tomorrow. |
The dunder methods are not meant to call directly like that, so we shouldn't guarantee any stability here IMO |
Alternative solution for when the right array operand is not exactly shape-aligned to avoid the axis: Reshape (and potentially broadcast) the array so it automatically aligns on the index dimension (axis=0):
You need to do the same when using ufuncs like |
So give that it's a dunder method that shouldn't be called directly, and given that there are alternatives, I think it is fine to close this issue. (note, we could still discuss separately if we want to add a "flex" method for those logical operations, like we have a |
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: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
This worked in pandas 1.1.5
Expected Output
Output of
pd.show_versions()
pandas : 1.2.1
numpy : 1.19.5
pytz : 2020.5
dateutil : 2.8.1
pip : 20.3.3
setuptools : 51.1.2.post20210112
Cython : None
pytest : 6.2.1
hypothesis : None
sphinx : None
blosc : None
feather : 0.4.1
xlsxwriter : None
lxml.etree : 4.6.2
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.12.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : 0.8.3
fastparquet : None
gcsfs : None
matplotlib : 3.2.2
numexpr : 2.7.2
odfpy : None
openpyxl : 3.0.6
pandas_gbq : None
pyarrow : 2.0.0
pyxlsb : None
s3fs : 0.5.2
scipy : 1.6.0
sqlalchemy : 1.3.22
tables : 3.6.1
tabulate : None
xarray : 0.16.2
xlrd : 2.0.1
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: