-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Undocumented behavior change (1.0.5->1.1.0) when using arithmetic operations on dataframes #36702
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
Confirmed this on the latest commit in master. It seems to me like this changes could have been caused by #31296 or #33600, but this is at first glance, since I'm not familiar with these PRs, and we changed a ton of stuff in 1.1.0 @jbrockmendel , could those PRs have caused this? |
I don't think this was every anything but accidently working, how exactly do you align these series? this is very very odd. in fact I would say we should raise here. This is very different from say lists of ndarrays which we do support because no alignment is involved. |
@mhaselsteiner formatting your example would make it clearer to the reader what's going on:
Like @jreback said, the solution is to not do this. |
Makes sense that we should raise when the user tries something like this. I'll take a look at how it can be implemented. |
take |
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.
Code Sample, a copy-pastable example
pandas 1.0.5:
pandas 1.1.0:
Problem description
When applying arithmetic operations between dataframe and list of Series prior to 1.0.5 and we get different results then starting with 1.1.0. Starting with 1.1.0 we seem to get a another level of indexing, altough the dataframes columns and index return the same values, iterating over it returns different objects.
Since now the return type of the chained iloc has changed from float/int to series, this breaks functions using the arithmetic operator like this.
Expected Output
Output of
pd.show_versions()
using the latest pandas version:
pandas : 1.1.2
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 49.6.0.post20200917
Cython : None
pytest : 6.0.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
using 1.0.3
The text was updated successfully, but these errors were encountered: