-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: MultiIndex block assignment introduces NaNs in data #40186
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 happens on master branch as well. |
I think |
I am making very slow progress on understanding this but, interestingly, I just found out that indexing the dataframe instead of using See a working example :
|
I have a proof of concept
On 1.2.5 and 1.3.0 we get
On master we get
This bug is causing failures on statsmodels when testing against pandas master. |
This is the same as underlying issue as #45751 right? here's another example
very unintuitive behavior |
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
Problem description
When assigning to block of MultiIndex-ed dataframe (I tested with columnar multi-index), data becomes covered with NaNs instead. Same happens when doing right-assign arithmetic operations (
*=
,+=
etc.). It is not required for RHS to point to same data storage - any dataframe with corresponding index/columns gives same effect.Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : f2c8480
python : 3.8.2.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1251
pandas : 1.2.3
numpy : 1.18.1
pytz : 2020.1
dateutil : 2.8.1
pip : 21.0.1
setuptools : 41.2.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.13.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.2.0
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: