Description
- I have checked that this issue has not already been reported.
- (optional) I have confirmed this bug exists on the master branch of pandas.
Note: Not in a released pandas, only master
Code Sample
import pandas as pd
mi = pd.MultiIndex.from_product([["a","b"],[1,2],["z","y"]])
df = pd.DataFrame(index=mi,dtype=float)
mi2 = pd.MultiIndex.from_product([["a","b"],[1,2]])
s = pd.Series(index=mi2, dtype=float)
s.iloc[:]=3.14
df["new"] = s
print(df)
Problem description
In 1.3.0 MultiIndex assignment broadcast missing levels. As of #42231, this no longer works.
Expected Output
In master, I see
new
a 1 z NaN
y NaN
2 z NaN
y NaN
b 1 z NaN
y NaN
2 z NaN
y NaN
In 1.3.0 or 1.2.5, I see
new
a 1 z 3.14
y 3.14
2 z 3.14
y 3.14
b 1 z 3.14
y 3.14
2 z 3.14
y 3.14
Output of pd.show_versions()
pandas : 1.4.0.dev0+246.gf3a6753d2d
numpy : 1.20.2
pytz : 2021.1
dateutil : 2.8.1
pip : 21.1.3
setuptools : 52.0.0.post20210125
Cython : 0.29.23
pytest : 6.2.4
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.22.0
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 : 1.7.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
</details>