You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The calculation of ft1 doesn't broadcast as expected. Instead, it treats the differently-named indexed columns as identical and performs a component-wise addition.
The calculation of ft2 is as expected.
ft1 and ft2 having different index columns is definitely not expected.
Output That I See
val
second third
1 1 11
2 22
2 1 33
2 44
val
third second first
1 1 1 11
2 31
2 1 13
2 33
2 1 1 22
2 42
2 1 24
2 44
Expected Output
The expected output of the two calculations should be the same, possibly with the rows returned in a different order.
val
third second first
1 1 1 11
2 31
2 1 13
2 33
2 1 1 22
2 42
2 1 24
2 44
val
third second first
1 1 1 11
2 31
2 1 13
2 33
2 1 1 22
2 42
2 1 24
2 44
The problem is that MultiIndex.equals doesn't check the names, and so reports indices as equal when they're not. This in turn means the non-broadcasting case is taken, when it should broadcast.
Output of pd.show_versions()
INSTALLED VERSIONS
commit : ae79bb2
python : 3.8.0.final.0
python-bits : 64
OS : Linux
OS-release : 4.19.76-linuxkit
Version : #1 SMP Thu Oct 17 19:31:58 UTC 2019
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
Code Sample
Problem description
The calculation of
ft1
doesn't broadcast as expected. Instead, it treats the differently-named indexed columns as identical and performs a component-wise addition.The calculation of
ft2
is as expected.ft1
andft2
having different index columns is definitely not expected.Output That I See
Expected Output
The expected output of the two calculations should be the same, possibly with the rows returned in a different order.
Where the problem lies
The problem appears to be in MultiIndex.equals
This is called by NDFrame. _indexed_same, which is called by _align_method_FRAME
The problem is that MultiIndex.equals doesn't check the names, and so reports indices as equal when they're not. This in turn means the non-broadcasting case is taken, when it should broadcast.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : ae79bb2
python : 3.8.0.final.0
python-bits : 64
OS : Linux
OS-release : 4.19.76-linuxkit
Version : #1 SMP Thu Oct 17 19:31:58 UTC 2019
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.0.dev0+725.gae79bb23c
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 19.3.1
setuptools : 41.6.0
Cython : 0.29.15
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
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
See also (I haven't checked if these are related, but they "sound similar")
#20565
#5645
#19606
The text was updated successfully, but these errors were encountered: