-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Inconsistent .loc slicing behaviour with NaNs in MultiIndex dataframe #29751
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
Works now.
May need some tests |
Hi @phofl, I would love to contribute to this issue, Please let me know if I may :) |
Yes for sure. As long as it is unassigned, everyone is free to work on |
@ankushduacodes seems like you are not working on this issue as it is unassigned |
take |
@kasim95 hi... I didn't know contributors could assign themselves as i am new to the repo. But fair enough, I will work on some other issue. |
Oh, i assumed that the issue is stale since there was no comment/update in the past 21 days. Are you still working on this issue? Let me know if you want to work on it so that I'll unassign myself. |
I was just busy working on some other stuff. I have not started working on it. So its all you. Thank your for confirmation.😀 |
Code Sample, a copy-pastable example if possible
Problem description
As above, slicing on MultiIndex has different behaviours with nans: it excludes the current index of selection from the slice. This is possibly because - rightly so - there is no match on NaNs when comparing the indices, but if that is the case, this should also not work:
Note: might be a duplicate of #25154, but OP does not slice directly on the MultiIndex with NaNs, so I am not sure if fixing that would also fix this issue.
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.4.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 0.25.1
numpy : 1.16.4
pytz : 2019.2
dateutil : 2.8.0
pip : 19.2.2
setuptools : 41.0.1
Cython : 0.29.13
pytest : 5.1.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.1.8
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.8.0
pandas_datareader: None
bs4 : None
bottleneck : 1.2.1
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : 2.6.2
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.1
sqlalchemy : 1.3.7
tables : None
xarray : 0.12.3
xlrd : 1.2.0
xlwt : None
xlsxwriter : 1.1.8
The text was updated successfully, but these errors were encountered: