-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Maybe wrong default axis with operators (add, sub, mul, div) between datetime-indexed df and series 1.0.0 #31487
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
That documentation might not have been up to date for a long time. I went back up to pandas 0.18 with your example above, and it is still giving the same result as we have now on 1.0. Could you try to find a reproducible example and show the result you get? (if you still have an environment with an older version of pandas, or otherwise you can try to recreate that?) |
I think I started refactoring the arithmetic code about 2 years ago, and dont remember the described behavior existing at the time. The described behavior does seem analogous to the slicing special-casing xref #31476. |
I couldn't find an example, I'll post it if I get an error at some point :( you can close the issue in the meantime if you want. Thanks for letting me know about the documentation (it probably needs updating then?). By the way, what is the rationale of aligning a series to the columns of a dataframe with arithmetics? Is it to replicate the behavior of numpy arrays? |
Code Sample, a copy-pastable example if possible
Problem description
According to the docs (https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html#data-alignment-and-arithmetic):
It seems to me that in both cases now the broadcasting is row-wise.
Is this an expected change for pandas 1.0.0 (I hope not - I never saw any FutureWarnings about it)? If so, the docs (and the examples) must be updated.
The same happens for the operators
-
,/
,*
,%
Expected Output
Not sure if this is the expected output anymore, but it used to be equivalent to:
Although I can't replicate it, I'm pretty sure this was the behaviour until pandas 0.25.3
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 1.0.0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.1.0.post20200127
Cython : 0.29.14
pytest : 5.3.4
hypothesis : 4.54.2
sphinx : 2.3.1
blosc : None
feather : None
xlsxwriter : 1.2.7
lxml.etree : 4.4.2
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.11.1
pandas_datareader: None
bs4 : 4.8.2
bottleneck : 1.3.1
fastparquet : None
gcsfs : None
lxml.etree : 4.4.2
matplotlib : 3.1.1
numexpr : 2.7.0
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : None
pytables : None
pytest : 5.3.4
pyxlsb : None
s3fs : 0.4.0
scipy : 1.3.2
sqlalchemy : 1.3.13
tables : 3.6.1
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.2.7
numba : 0.47.0
The text was updated successfully, but these errors were encountered: